Debian Codegraph @

js/src/tests/test262/built-ins/Promise/allSettled/resolve-non-thenable.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 description: Resolving with a non-thenable object value
6 esid: sec-promise.allsettled
7 info: |
8 Promise.allSettled Resolve Element Functions
9
10 14. If remainingElementsCount.[[Value]] is 0, then
11 a. Let valuesArray be ! CreateArrayFromList(values).
12 b. Return ? Call(promiseCapability.[[Resolve]], undefined, « valuesArray »).
13 flags: [async]
14 includes: [promiseHelper.js]
15 features: [Promise.allSettled]
16 ---*/
17
18 var v1 = {};
19 var v2 = {};
20 var v3 = {};
21
22 Promise.allSettled([v1, v2, v3])
23 .then(function(values) {
24 checkSettledPromises(values, [
25 {
26 status: 'fulfilled',
27 value: v1
28 },
29 {
30 status: 'fulfilled',
31 value: v2
32 },
33 {
34 status: 'fulfilled',
35 value: v3
36 }
37 ], 'values');
38 }, function() {
39 $DONE('The promise should not be rejected.');
40 }).then($DONE, $DONE);