Skip to content

Commit

Permalink
Update: Improve tests
Browse files Browse the repository at this point in the history
  • Loading branch information
phated committed Jun 27, 2016
1 parent ca32513 commit c7cabad
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions test/timeParallel.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});

0 comments on commit c7cabad

Please sign in to comment.