Files: d2f2697f296dd39aed6a8b63c6d04a736a7db5b3 / node_modules / multicb / test / spread.js
543 bytesRaw
1 | |
2 | var multicb = require('../') |
3 | var t = require('assert') |
4 | |
5 | require('interleavings').test(function (isAsync) { |
6 | |
7 | function async(cb, delay, args) { |
8 | isAsync(function() { cb.apply(null, args) })() |
9 | } |
10 | |
11 | var done = multicb({ pluck: 1, spread: true }) |
12 | async(done(), 5, [null, 1]) |
13 | async(done(), 15, [null, 2]) |
14 | async(done(), 10, [null, 3]) |
15 | done(function(err, first, second, third) { |
16 | console.log('done') |
17 | t.equal(err, null) |
18 | t.equal(first, 1) |
19 | t.equal(second, 2) |
20 | t.equal(third, 3) |
21 | isAsync.done() |
22 | }) |
23 | |
24 | }) |
25 |
Built with git-ssb-web