Debian Codegraph @

js/src/tests/test262/built-ins/Promise/any/resolve-from-reject-catch.js

raw
1 // |reftest| async
2 // Copyright (C) 2020 Rick Waldron. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
4
5 /*---
6 esid: sec-promise.any
7 description: >
8 Promise.any resolves with the first item that does not reject.
9 flags: [async]
10 features: [Promise.any, arrow-function]
11 ---*/
12
13 let fulfillables = [
14 Promise.reject('a'),
15 new Promise((resolve, reject) => reject('b')),
16 Promise.all([Promise.reject('c')]),
17 Promise.reject('d').catch(v => v),
18 ];
19
20 Promise.any(fulfillables)
21 .then((resolution) => {
22 assert.sameValue(resolution, 'd');
23 }).then($DONE, $DONE);