From 03da22868a3e0b9ecdee4a5d754c72df93baf995 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Tue, 30 Jan 2018 15:59:42 -0800 Subject: [PATCH] Promise.prototype.finally: add more tests - per https://github.com/tc39/ecma262/pull/1083#issuecomment-361775023 --- .../prototype/finally/invokes-then-with-function.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 d7b808611c..648b7dd6f9 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 @@ -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`');