create-resolving-functions-reject.js (1032B)
1 // |reftest| async 2 // Copyright (C) 2019 Alexey Shvayka. All rights reserved. 3 // This code is governed by the BSD license found in the LICENSE file. 4 /*--- 5 esid: sec-createresolvingfunctions 6 description: > 7 reject is anonymous built-in function with length of 1. 8 info: | 9 CreateResolvingFunctions ( promise ) 10 11 ... 12 7. Let reject be ! CreateBuiltinFunction(stepsReject, « [[Promise]], [[AlreadyResolved]] »). 13 features: [Reflect.construct, arrow-function] 14 includes: [isConstructor.js] 15 flags: [async] 16 ---*/ 17 18 Promise.resolve(1).then(function() { 19 return Promise.resolve(); 20 }).then($DONE, $DONE); 21 22 var then = Promise.prototype.then; 23 Promise.prototype.then = function(resolve, reject) { 24 assert.sameValue(isConstructor(reject), false, 'isConstructor(reject) must return false'); 25 assert.throws(TypeError, () => { 26 new reject(); 27 }); 28 29 assert.sameValue(reject.length, 1, 'The value of reject.length is 1'); 30 assert.sameValue(reject.name, '', 'The value of reject.name is ""'); 31 32 return then.call(this, resolve, reject); 33 };