mirror of
https://github.com/tc39/test262.git
synced 2025-07-24 06:25:30 +02:00
Add isConstructor to Promise.prototype.finally test
This commit is contained in:
parent
a12677ec4c
commit
95fd012c66
@ -4,7 +4,8 @@
|
|||||||
author: Jordan Harband
|
author: Jordan Harband
|
||||||
description: Promise.prototype.finally invokes `then` method
|
description: Promise.prototype.finally invokes `then` method
|
||||||
esid: sec-promise.prototype.finally
|
esid: sec-promise.prototype.finally
|
||||||
features: [Promise.prototype.finally]
|
features: [Promise.prototype.finally, Reflect.construct]
|
||||||
|
includes: [isConstructor.js]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
var target = new Promise(function() {});
|
var target = new Promise(function() {});
|
||||||
@ -27,8 +28,6 @@ target.then = function(a, b) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var originalFinallyHandler = function() {};
|
var originalFinallyHandler = function() {};
|
||||||
var anonName = Object(function() {}).name;
|
|
||||||
|
|
||||||
var result = Promise.prototype.finally.call(target, originalFinallyHandler, 2, 3);
|
var result = Promise.prototype.finally.call(target, originalFinallyHandler, 2, 3);
|
||||||
|
|
||||||
assert.sameValue(callCount, 1, 'Invokes `then` method exactly once');
|
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.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.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(
|
assert.sameValue(
|
||||||
typeof secondArg,
|
typeof secondArg,
|
||||||
@ -54,6 +54,7 @@ assert.sameValue(
|
|||||||
);
|
);
|
||||||
assert.notSameValue(secondArg, originalFinallyHandler, 'Invokes `then` method with a different rejection handler');
|
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.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`');
|
assert.sameValue(result, returnValue, 'Returns the result of the invocation of `then`');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user