From 95fd012c668e5b88076a6a34e97c94ed80773855 Mon Sep 17 00:00:00 2001 From: Alexey Shvayka Date: Sun, 12 Jan 2020 02:13:22 +0200 Subject: [PATCH] Add isConstructor to Promise.prototype.finally test --- .../prototype/finally/invokes-then-with-function.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/test/built-ins/Promise/prototype/finally/invokes-then-with-function.js b/test/built-ins/Promise/prototype/finally/invokes-then-with-function.js index 697bea0b3e..3995cb5e5f 100644 --- a/test/built-ins/Promise/prototype/finally/invokes-then-with-function.js +++ b/test/built-ins/Promise/prototype/finally/invokes-then-with-function.js @@ -4,7 +4,8 @@ author: Jordan Harband description: Promise.prototype.finally invokes `then` method esid: sec-promise.prototype.finally -features: [Promise.prototype.finally] +features: [Promise.prototype.finally, Reflect.construct] +includes: [isConstructor.js] ---*/ var target = new Promise(function() {}); @@ -27,8 +28,6 @@ target.then = function(a, b) { }; var originalFinallyHandler = function() {}; -var anonName = Object(function() {}).name; - var result = Promise.prototype.finally.call(target, originalFinallyHandler, 2, 3); assert.sameValue(callCount, 1, 'Invokes `then` method exactly once'); @@ -45,7 +44,8 @@ assert.sameValue( ); assert.notSameValue(firstArg, originalFinallyHandler, 'Invokes `then` method with a different fulfillment handler'); assert.sameValue(firstArg.length, 1, 'fulfillment handler has a length of 1'); -assert.sameValue(firstArg.name, anonName, 'fulfillment handler is anonymous'); +assert.sameValue(firstArg.name, '', 'fulfillment handler is anonymous'); +assert(!isConstructor(firstArg), 'fulfillment handler is not constructor'); assert.sameValue( typeof secondArg, @@ -54,6 +54,7 @@ assert.sameValue( ); assert.notSameValue(secondArg, originalFinallyHandler, 'Invokes `then` method with a different rejection handler'); assert.sameValue(secondArg.length, 1, 'rejection handler has a length of 1'); -assert.sameValue(secondArg.name, anonName, 'rejection handler is anonymous'); +assert.sameValue(secondArg.name, '', 'rejection handler is anonymous'); +assert(!isConstructor(secondArg), 'rejection handler is not constructor'); assert.sameValue(result, returnValue, 'Returns the result of the invocation of `then`');