Skip to content

Commit

Permalink
Merge pull request #47 from ahw/master
Browse files Browse the repository at this point in the history
Additional test cases for async sequence
  • Loading branch information
kolodny authored Jul 1, 2016
2 parents 896c3f6 + 53c58c2 commit 9d620c2
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions async/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,40 @@ describe('async', function() {
done();
});
});

it('correctly handles sync functions in sequence', function(done) {
var fun1 = function(cb) {
cb(null, 'test1');
};
var fun2 = function(cb, data) {
cb(null, data);
};

// returns a thunk
async.sequence([fun1, fun2])(function(err, data) {
assert.equal(data, 'test1');
done();
});
});

it('handles delayed thunk invocation', function(done) {
var fun1 = function(cb) {
cb(null, 'test2');
};
var fun2 = function(cb, data) {
cb(null, data.toUpperCase());
};

// returns a thunk
var setter = async.sequence([fun1, fun2])

setTimeout(function() {
setter(function(err, data) {
assert.equal(data, 'TEST2');
done();
});
}, 100)
});
});

describe('has a parallel method that', function() {
Expand Down

0 comments on commit 9d620c2

Please sign in to comment.