Skip to content

Commit 1935e0b

Browse files
author
Nick Santos
committed
add a test on q.all synchronization
1 parent fb98f18 commit 1935e0b

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

test/spread.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,27 @@ exports.testSpreadBoundMethod = function (test) {
3333
test.done()
3434
}, {scope: 'scope'}, 'c')
3535
}
36+
37+
exports.testAllSynchronization1 = function (test) {
38+
var order = []
39+
Q.resolve(true)
40+
.then(function () {
41+
var promiseA = Q.fcall(function () {
42+
order.push('a')
43+
})
44+
var promiseB = Q.fcall(function () {
45+
order.push('b')
46+
})
47+
48+
test.deepEqual([], order)
49+
50+
var promiseAB = Q.all([promiseA, promiseB])
51+
test.deepEqual([], order)
52+
53+
return [promiseA, promiseB]
54+
})
55+
.then(function (results) {
56+
test.deepEqual(['a', 'b'], order)
57+
test.done()
58+
})
59+
}

0 commit comments

Comments
 (0)