summaryrefslogtreecommitdiff
path: root/test/test-async.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/test-async.js')
-rwxr-xr-xtest/test-async.js271
1 files changed, 0 insertions, 271 deletions
diff --git a/test/test-async.js b/test/test-async.js
index e35bdcf..e02c0df 100755
--- a/test/test-async.js
+++ b/test/test-async.js
@@ -152,277 +152,6 @@ exports['seq without callback'] = function (test) {
add2mul3.call(testcontext, 3);
};
-
-exports['parallel'] = function(test){
- var call_order = [];
- async.parallel([
- function(callback){
- setTimeout(function(){
- call_order.push(1);
- callback(null, 1);
- }, 50);
- },
- function(callback){
- setTimeout(function(){
- call_order.push(2);
- callback(null, 2);
- }, 100);
- },
- function(callback){
- setTimeout(function(){
- call_order.push(3);
- callback(null, 3,3);
- }, 25);
- }
- ],
- function(err, results){
- test.ok(err === null, err + " passed instead of 'null'");
- test.same(call_order, [3,1,2]);
- test.same(results, [1,2,[3,3]]);
- test.done();
- });
-};
-
-exports['parallel empty array'] = function(test){
- async.parallel([], function(err, results){
- test.ok(err === null, err + " passed instead of 'null'");
- test.same(results, []);
- test.done();
- });
-};
-
-exports['parallel error'] = function(test){
- async.parallel([
- function(callback){
- callback('error', 1);
- },
- function(callback){
- callback('error2', 2);
- }
- ],
- function(err){
- test.equals(err, 'error');
- });
- setTimeout(test.done, 100);
-};
-
-exports['parallel no callback'] = function(test){
- async.parallel([
- function(callback){callback();},
- function(callback){callback(); test.done();},
- ]);
-};
-
-exports['parallel object'] = function(test){
- var call_order = [];
- async.parallel(getFunctionsObject(call_order), function(err, results){
- test.equals(err, null);
- test.same(call_order, [3,1,2]);
- test.same(results, {
- one: 1,
- two: 2,
- three: [3,3]
- });
- test.done();
- });
-};
-
-// Issue 10 on github: https://github.com/caolan/async/issues#issue/10
-exports['paralel falsy return values'] = function (test) {
- function taskFalse(callback) {
- async.nextTick(function() {
- callback(null, false);
- });
- }
- function taskUndefined(callback) {
- async.nextTick(function() {
- callback(null, undefined);
- });
- }
- function taskEmpty(callback) {
- async.nextTick(function() {
- callback(null);
- });
- }
- function taskNull(callback) {
- async.nextTick(function() {
- callback(null, null);
- });
- }
- async.parallel(
- [taskFalse, taskUndefined, taskEmpty, taskNull],
- function(err, results) {
- test.equal(results.length, 4);
- test.strictEqual(results[0], false);
- test.strictEqual(results[1], undefined);
- test.strictEqual(results[2], undefined);
- test.strictEqual(results[3], null);
- test.done();
- }
- );
-};
-
-
-exports['parallel limit'] = function(test){
- var call_order = [];
- async.parallelLimit([
- function(callback){
- setTimeout(function(){
- call_order.push(1);
- callback(null, 1);
- }, 50);
- },
- function(callback){
- setTimeout(function(){
- call_order.push(2);
- callback(null, 2);
- }, 100);
- },
- function(callback){
- setTimeout(function(){
- call_order.push(3);
- callback(null, 3,3);
- }, 25);
- }
- ],
- 2,
- function(err, results){
- test.ok(err === null, err + " passed instead of 'null'");
- test.same(call_order, [1,3,2]);
- test.same(results, [1,2,[3,3]]);
- test.done();
- });
-};
-
-exports['parallel limit empty array'] = function(test){
- async.parallelLimit([], 2, function(err, results){
- test.ok(err === null, err + " passed instead of 'null'");
- test.same(results, []);
- test.done();
- });
-};
-
-exports['parallel limit error'] = function(test){
- async.parallelLimit([
- function(callback){
- callback('error', 1);
- },
- function(callback){
- callback('error2', 2);
- }
- ],
- 1,
- function(err){
- test.equals(err, 'error');
- });
- setTimeout(test.done, 100);
-};
-
-exports['parallel limit no callback'] = function(test){
- async.parallelLimit([
- function(callback){callback();},
- function(callback){callback(); test.done();},
- ], 1);
-};
-
-exports['parallel limit object'] = function(test){
- var call_order = [];
- async.parallelLimit(getFunctionsObject(call_order), 2, function(err, results){
- test.equals(err, null);
- test.same(call_order, [1,3,2]);
- test.same(results, {
- one: 1,
- two: 2,
- three: [3,3]
- });
- test.done();
- });
-};
-
-exports['parallel call in another context'] = function(test) {
- if (isBrowser()) {
- // node only test
- test.done();
- return;
- }
- var vm = require('vm');
- var sandbox = {
- async: async,
- test: test
- };
-
- var fn = "(" + (function () {
- async.parallel([function (callback) {
- callback();
- }], function (err) {
- if (err) {
- return test.done(err);
- }
- test.done();
- });
- }).toString() + "())";
-
- vm.runInNewContext(fn, sandbox);
-};
-
-exports['parallel error with reflect'] = function(test){
- async.parallel([
- async.reflect(function(callback){
- callback('error', 1);
- }),
- async.reflect(function(callback){
- callback('error2', 2);
- }),
- async.reflect(function(callback){
- callback(null, 2);
- })
- ],
- function(err, results){
- test.ok(err === null, err + " passed instead of 'null'");
- test.same(results, [
- { error: 'error' },
- { error: 'error2' },
- { value: 2 }
- ]);
- test.done();
- });
-};
-
-exports['parallel does not continue replenishing after error'] = function (test) {
- var started = 0;
- var arr = [
- funcToCall,
- funcToCall,
- funcToCall,
- funcToCall,
- funcToCall,
- funcToCall,
- funcToCall,
- funcToCall,
- funcToCall,
- ];
- var delay = 10;
- var limit = 3;
- var maxTime = 10 * arr.length;
- function funcToCall(callback) {
- started ++;
- if (started === 3) {
- return callback(new Error ("Test Error"));
- }
- setTimeout(function(){
- callback();
- }, delay);
- }
-
- async.parallelLimit(arr, limit, function(){});
-
- setTimeout(function(){
- test.equal(started, 3);
- test.done();
- }, maxTime);
-};
-
-
exports['series'] = {
'series': function(test){