summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Promise/allSettled/resolve-non-thenable.js
blob: 389ea479774661c9ce5853201e43ffdfb3c90180 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// |reftest| async
// Copyright (C) 2019 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Resolving with a non-thenable object value
esid: sec-promise.allsettled
info: |
  Promise.allSettled Resolve Element Functions

  14. If remainingElementsCount.[[Value]] is 0, then
    a. Let valuesArray be ! CreateArrayFromList(values).
    b. Return ? Call(promiseCapability.[[Resolve]], undefined, « valuesArray »).
flags: [async]
includes: [promiseHelper.js]
features: [Promise.allSettled]
---*/

var v1 = {};
var v2 = {};
var v3 = {};

Promise.allSettled([v1, v2, v3])
  .then(function(values) {
    checkSettledPromises(values, [
      {
        status: 'fulfilled',
        value: v1
      },
      {
        status: 'fulfilled',
        value: v2
      },
      {
        status: 'fulfilled',
        value: v3
      }
    ], 'values');
  }, function() {
    $DONE('The promise should not be rejected.');
  }).then($DONE, $DONE);