Skip to content

Commit 03da228

Browse files
ljharbrwaldron
authored andcommitted
Promise.prototype.finally: add more tests
- per tc39/ecma262#1083 (comment)
1 parent 1989f0f commit 03da228

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

test/built-ins/Promise/prototype/finally/invokes-then-with-function.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ target.then = function(a, b) {
2727
};
2828

2929
var originalFinallyHandler = function () {};
30+
var anonName = Object(function () {}).name;
3031

3132
var result = Promise.prototype.finally.call(target, originalFinallyHandler, 2, 3);
3233

@@ -43,11 +44,16 @@ assert.sameValue(
4344
'Invokes `then` method with a function as the first argument'
4445
);
4546
assert.notSameValue(firstArg, originalFinallyHandler, 'Invokes `then` method with a different fulfillment handler');
47+
assert.sameValue(firstArg.length, 1, 'fulfillment handler has a length of 1');
48+
assert.sameValue(firstArg.name, anonName, 'fulfillment handler is anonymous');
49+
4650
assert.sameValue(
4751
typeof secondArg,
4852
'function',
4953
'Invokes `then` method with a function as the second argument'
5054
);
51-
assert.notSameValue(secondArg, originalFinallyHandler, 'Invokes `then` method with a different fulfillment handler');
55+
assert.notSameValue(secondArg, originalFinallyHandler, 'Invokes `then` method with a different rejection handler');
56+
assert.sameValue(secondArg.length, 1, 'rejection handler has a length of 1');
57+
assert.sameValue(secondArg.name, anonName, 'rejection handler is anonymous');
5258

5359
assert.sameValue(result, returnValue, 'Returns the result of the invocation of `then`');

0 commit comments

Comments
 (0)