Files: d2f2697f296dd39aed6a8b63c6d04a736a7db5b3 / node_modules / multicb / test / multicb.js
527 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() |
12 | async(done(), 5, [null, 1]) |
13 | async(done(), 15, [null, 2]) |
14 | async(done(), 10, [null, 3]) |
15 | done(function(err, results) { |
16 | console.log('done') |
17 | t.equal(err, null) |
18 | t.equal(results[0][1], 1) |
19 | t.equal(results[1][1], 2) |
20 | t.equal(results[2][1], 3) |
21 | isAsync.done() |
22 | }) |
23 | |
24 | }) |
25 |
Built with git-ssb-web