Debian Codegraph @

js/src/tests/test262/built-ins/Promise/all/S25.4.4.1_A7.1_T1.js

raw
1 // |reftest| async
2 // Copyright 2014 Cubane Canada, Inc. All rights reserved.
3 // See LICENSE for details.
4
5 /*---
6 info: |
7 Promise.all with 1-element array
8 should accept an array with settled promise
9 es6id: S25.4.4.1_A6.1_T2
10 author: Sam Mikes
11 description: Promise.all([p1]) is resolved with a promise for a one-element array
12 flags: [async]
13 ---*/
14
15 var p1 = Promise.resolve(3);
16
17 var pAll = Promise.all([p1]);
18
19 pAll.then(function(result) {
20 assert(!!(pAll instanceof Promise), 'The value of !!(pAll instanceof Promise) is expected to be true');
21 assert(!!(result instanceof Array), 'The value of !!(result instanceof Array) is expected to be true');
22 assert.sameValue(result.length, 1, 'The value of result.length is expected to be 1');
23 assert.sameValue(result[0], 3, 'The value of result[0] is expected to be 3');
24 }).then($DONE, $DONE);