summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Promise/any/reject-all-mixed.js
blob: 0a4da17aa3edec710e221fea56ced627f3fcd4c5 (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
// |reftest| async
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-promise.any
description: >
  Promise.any rejection reasons from various rejections are all present
flags: [async]
features: [Promise.any, arrow-function]
---*/

let rejections = [
  Promise.reject('a'),
  new Promise((_, reject) => reject('b')),
  Promise.all([Promise.reject('c')]),
  Promise.resolve(Promise.reject('d')),
];

Promise.any(rejections)
  .then(
    () => $DONE('The promise should be rejected, but was resolved'),
    error => {
      assert.sameValue(error.errors.length, rejections.length);
      assert.sameValue(error.errors.join(''), 'abcd');
    }
  ).then($DONE, $DONE);