mirror of
https://github.com/tc39/test262.git
synced 2025-07-20 20:44:43 +02:00
Promise.prototype.finally: add more tests
- per https://github.com/tc39/ecma262/pull/1083#issuecomment-361775023
This commit is contained in:
parent
1989f0fe6d
commit
03da22868a
@ -27,6 +27,7 @@ target.then = function(a, b) {
|
||||
};
|
||||
|
||||
var originalFinallyHandler = function () {};
|
||||
var anonName = Object(function () {}).name;
|
||||
|
||||
var result = Promise.prototype.finally.call(target, originalFinallyHandler, 2, 3);
|
||||
|
||||
@ -43,11 +44,16 @@ assert.sameValue(
|
||||
'Invokes `then` method with a function as the first argument'
|
||||
);
|
||||
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(
|
||||
typeof secondArg,
|
||||
'function',
|
||||
'Invokes `then` method with a function as the second argument'
|
||||
);
|
||||
assert.notSameValue(secondArg, originalFinallyHandler, 'Invokes `then` method with a different fulfillment 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.name, anonName, 'rejection handler is anonymous');
|
||||
|
||||
assert.sameValue(result, returnValue, 'Returns the result of the invocation of `then`');
|
||||
|
Loading…
x
Reference in New Issue
Block a user