diff options
author | zaphod1984 <zaphod84@gmx.de> | 2013-02-06 10:28:30 +0100 |
---|---|---|
committer | zaphod1984 <zaphod84@gmx.de> | 2013-02-06 10:28:30 +0100 |
commit | 13a9abf61d8a9696ac7f9b77451a7c98f9b18882 (patch) | |
tree | 3dd2a58a758b716a3c67da39bc02b990bf99e002 /test | |
parent | 41ea9687a9412f2e5374f822fb2337127db3ada1 (diff) | |
download | async-13a9abf61d8a9696ac7f9b77451a7c98f9b18882.tar.gz |
fixed queue bug, added test
Diffstat (limited to 'test')
-rwxr-xr-x[-rw-r--r--] | test/test-async.js | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/test/test-async.js b/test/test-async.js index fafa6d7..323527a 100644..100755 --- a/test/test-async.js +++ b/test/test-async.js @@ -1587,6 +1587,37 @@ exports['queue'] = function (test) { }; }; +exports['queue error propagation'] = function(test){ + var results = []; + + var q = async.queue(function (task, callback) { + callback(task.name === 'foo' ? new Error('fooError') : null); + }, 2); + + q.drain = function() { + test.deepEqual(results, ['bar', 'fooError']); + test.done(); + }; + + q.push({name: 'bar'}, function (err) { + if(err) { + results.push('barError'); + return; + } + + results.push('bar'); + }); + + q.push({name: 'foo'}, function (err) { + if(err) { + results.push('fooError'); + return; + } + + results.push('foo'); + }); +}; + exports['queue changing concurrency'] = function (test) { var call_order = [], delays = [40,20,60,20]; |