From c7cabad7b1884f0859d56505b6702eaec30894a8 Mon Sep 17 00:00:00 2001 From: Blaine Bublitz Date: Sun, 10 Aug 2014 12:28:15 -0700 Subject: [PATCH] Update: Improve tests --- test/timeParallel.js | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) 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); + }); });