| 1 |
// Copyright 2014 Cubane Canada, Inc. All rights reserved. |
| 2 |
// See LICENSE for details. |
| 3 |
|
| 4 |
/*--- |
| 5 |
info: | |
| 6 |
Promise.all with 2-element array |
| 7 |
es6id: S25.4.4.1_A8.2_T2 |
| 8 |
author: Sam Mikes |
| 9 |
description: Promise.all() rejects when second promise in array rejects |
| 10 |
flags: [async] |
| 11 |
---*/ |
| 12 |
|
| 13 |
var rejectP2, |
| 14 |
p1 = Promise.resolve(1), |
| 15 |
p2 = new Promise(function(resolve, reject) { |
| 16 |
rejectP2 = reject; |
| 17 |
}); |
| 18 |
|
| 19 |
Promise.all([p1, p2]).then(function() { |
| 20 |
$ERROR("Did not expect promise to be fulfilled."); |
| 21 |
}, function(rejected) { |
| 22 |
if (rejected !== 2) { |
| 23 |
$ERROR("Expected promise to be rejected with 2, actually " + rejected); |
| 24 |
} |
| 25 |
}).then($DONE, $DONE); |
| 26 |
|
| 27 |
rejectP2(2); |