Skip to content

Commit

Permalink
add test for #578. Closes #578
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Early committed Jun 1, 2015
1 parent 10c1d67 commit c49e59a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ Bug Fixes:
- `forever` will no longer stack overflow with a synchronous iterator (#622)
- `eachLimit` and others limit functions will stop iterating once an error occurs (#754)
- Always pass `null` in callbacks when there is no error (#439)
- Ensure proper conditions when calling `drain()` after pushing an empty data set to a queue (#668)
- Ensure proper conditions when calling `drain()` after pushing an empty data set to a queue (#668)
- `each` and family will properly handle an empty array (#578)
- Doc fixes (#766)


Expand Down
12 changes: 12 additions & 0 deletions test/test-async.js
Original file line number Diff line number Diff line change
Expand Up @@ -1371,6 +1371,18 @@ exports['forEachOf empty object'] = function(test){
setTimeout(test.done, 25);
};

exports['forEachOf empty array'] = function(test){
test.expect(1);
async.forEachOf([], function(value, key, callback){
test.ok(false, 'iterator should not be called');
callback();
}, function(err) {
if (err) throw err;
test.ok(true, 'should call callback');
});
setTimeout(test.done, 25);
};

exports['forEachOf error'] = function(test){
test.expect(1);
async.forEachOf({ a: 1, b: 2 }, function(value, key, callback) {
Expand Down

0 comments on commit c49e59a

Please sign in to comment.