diff options
author | Alexander Early <alexander.early@gmail.com> | 2015-05-21 23:15:47 -0700 |
---|---|---|
committer | Alexander Early <alexander.early@gmail.com> | 2015-05-21 23:15:47 -0700 |
commit | 3a1aff02096b12c0ed8669c3349f1659d96b4e5b (patch) | |
tree | 76f24d32f0936ab7d8b02bcd231a227c8e2d39e0 | |
parent | 5b6f080710fb4dbb6ef753d8680a2396ce73f8f8 (diff) | |
download | async-3a1aff02096b12c0ed8669c3349f1659d96b4e5b.tar.gz |
split waterfall tests into a group
-rwxr-xr-x | test/test-async.js | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/test/test-async.js b/test/test-async.js index 7c325c8..1cb860e 100755 --- a/test/test-async.js +++ b/test/test-async.js @@ -684,7 +684,9 @@ exports['retry as an embedded task'] = function(test) { }); }; -exports['waterfall'] = function(test){ +exports['waterfall'] = { + +'basic': function(test){ test.expect(7); var call_order = []; async.waterfall([ @@ -714,29 +716,29 @@ exports['waterfall'] = function(test){ test.ok(err === null, err + " passed instead of 'null'"); test.done(); }); -}; +}, -exports['waterfall empty array'] = function(test){ +'empty array': function(test){ async.waterfall([], function(err){ test.done(); }); -}; +}, -exports['waterfall non-array'] = function(test){ +'non-array': function(test){ async.waterfall({}, function(err){ test.equals(err.message, 'First argument to waterfall must be an array of functions'); test.done(); }); -}; +}, -exports['waterfall no callback'] = function(test){ +'no callback': function(test){ async.waterfall([ function(callback){callback();}, function(callback){callback(); test.done();} ]); -}; +}, -exports['waterfall async'] = function(test){ +'async': function(test){ var call_order = []; async.waterfall([ function(callback){ @@ -753,9 +755,9 @@ exports['waterfall async'] = function(test){ test.done(); } ]); -}; +}, -exports['waterfall error'] = function(test){ +'error': function(test){ test.expect(1); async.waterfall([ function(callback){ @@ -769,9 +771,9 @@ exports['waterfall error'] = function(test){ test.equals(err, 'error'); }); setTimeout(test.done, 50); -}; +}, -exports['waterfall multiple callback calls'] = function(test){ +'multiple callback calls': function(test){ var call_order = []; var arr = [ function(callback){ @@ -798,9 +800,9 @@ exports['waterfall multiple callback calls'] = function(test){ } ]; async.waterfall(arr); -}; +}, -exports['waterfall call in another context'] = function(test) { +'call in another context': function(test) { if (typeof process === 'undefined') { // node only test test.done(); @@ -825,8 +827,9 @@ exports['waterfall call in another context'] = function(test) { }).toString() + "())"; vm.runInNewContext(fn, sandbox); -}; +} +}; exports['parallel'] = function(test){ var call_order = []; |