summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Promise/allSettled/resolved-immed.js
blob: c6c2d4fcb4b0db52382dff5beda6f89b62eb99ed (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) 2019 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-promise.allsettled
description: Promise.allSettled([]) returns immediately
includes: [promiseHelper.js]
flags: [async]
features: [Promise.allSettled]
---*/

var sequence = [];

Promise.allSettled([]).then(function() {
  sequence.push(2);
}).catch($DONE);

Promise.resolve().then(function() {
  sequence.push(3);
}).then(function() {
  sequence.push(4);
  assert.sameValue(sequence.length, 4);
checkSequence(sequence, 'Promises resolved in unexpected sequence');
}).then($DONE, $DONE);

sequence.push(1);