Debian Codegraph @

js/src/tests/test262/built-ins/Promise/allSettled/reject-immed.js

raw
1 // |reftest| async
2 // Copyright (C) 2019 Leo Balter. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
4
5 /*---
6 description: Rejecting through immediate invocation of the provided resolving function
7 esid: sec-promise.allsettled
8 info: |
9 6. Let result be PerformPromiseAllSettled(iteratorRecord, C, promiseCapability).
10
11 Runtime Semantics: PerformPromiseAllSettled
12
13 6. Repeat
14 ...
15 z. Perform ? Invoke(nextPromise, "then", « resolveElement, rejectElement »).
16 flags: [async]
17 includes: [promiseHelper.js]
18 features: [Promise.allSettled]
19 ---*/
20
21 var simulation = {};
22 var thenable = {
23 then(_, reject) {
24 reject(simulation);
25 }
26 };
27
28 Promise.allSettled([thenable])
29 .then((settleds) => {
30 checkSettledPromises(settleds, [{ status: 'rejected', reason: simulation }]);
31 }).then($DONE, $DONE);