diff options
author | James Cox <th3james@gmail.com> | 2013-12-02 21:20:52 +0000 |
---|---|---|
committer | James Cox <th3james@gmail.com> | 2013-12-02 21:20:52 +0000 |
commit | e61160d03b8955f5c01d6caed476e4c9a6076a4a (patch) | |
tree | a2d1fb399e3f01b81c58b1a93ea959a17dc07fd1 | |
parent | f01b3992fbe7aa2f4881152143608ad666aea1cc (diff) | |
download | async-e61160d03b8955f5c01d6caed476e4c9a6076a4a.tar.gz |
Failing auto double callback on error test
-rwxr-xr-x | test/test-async.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/test-async.js b/test/test-async.js index ff401e7..39d61be 100755 --- a/test/test-async.js +++ b/test/test-async.js @@ -431,6 +431,27 @@ exports['auto removeListener has side effect on loop iterator'] = function(test) }); }; +// Issue 410 on github: https://github.com/caolan/async/issues/410 +exports['auto calls callback multiple times'] = function(test) { + var finalCallCount = 0; + async.auto({ + task1: function(callback) { callback(null); }, + task2: ['task1', function(callback) { callback(null); }] + }, + + // Final callback. This should only run once... + function(err) { + finalCallCount++; + console.log('Called ' + finalCallCount + ' times'); + if (finalCallCount > 1) { + test.done(new Error("Final auto callback should only be called once")); + } else { + test.done(); + throw new Error("An error"); + } + }); +}; + exports['waterfall'] = function(test){ test.expect(6); var call_order = []; |