blob: 3e89abf0be1d1f6a3c22304de93f639b82ea5062 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
/*---
includes: [compareArray.js]
flags: [async]
---*/
let stages = [];
var promise = new Promise(function(resolve, reject) {
stages.push('One');
reject(123);
})
stages.push('Two');
promise.then(() => {stages.push('Four'); return {num: 'Five'}})
.then(obj => {stages.push(obj.num); return {num: 'Six'}})
.then(obj => {stages.push(obj.num)})
.catch(v => assert.sameValue(v, 123))
.then(() => assert.compareArray(stages, ["One", "Two", "Three"]))
.then($DONE, $DONE);
stages.push('Three');
|