diff --git a/test/timeParallel.js b/test/timeParallel.js index 833cfd5..4039161 100644 --- a/test/timeParallel.js +++ b/test/timeParallel.js @@ -18,24 +18,32 @@ function fn3(done){ done(null, 3); } -function done(){} - test('should emit start event for each function', function(t){ - t.plan(3); + t.plan(4); - bach.on('start', function(evt){ + function onStart(evt){ t.ok(evt, 'start event should be defined'); - }); + } - bach.parallel(fn1, fn2, fn3)(console.log); + bach.on('start', onStart); + + bach.parallel(fn1, fn2, fn3)(function(err){ + t.ok(!err, 'error should be undefined'); + bach.removeListener('start', onStart); + }); }); test('should emit stop event for each function', function(t){ - t.plan(3); + t.plan(4); - bach.on('stop', function(evt){ + function onStop(evt){ t.ok(evt, 'stop event should be defined'); - }); + } + + bach.on('stop', onStop); - bach.parallel(fn1, fn2, fn3)(done); + bach.parallel(fn1, fn2, fn3)(function(err){ + t.ok(!err, 'error should be undefined'); + bach.removeListener('stop', onStop); + }); });