From b6d8b1a297e366328f8d1b911511ed6476d01e8d Mon Sep 17 00:00:00 2001 From: coderaiser Date: Wed, 21 May 2014 07:18:31 -0400 Subject: [PATCH] feature(util) asyncCall: add test --- test/lib/util.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/lib/util.js b/test/lib/util.js index 5cb6aab1..323faee3 100644 --- a/test/lib/util.js +++ b/test/lib/util.js @@ -79,6 +79,27 @@ }); }); + describe('asyncCall', function() { + it('should execute a couple functions async and return results in callback', function() { + var WORD = 'hello world', + funcSlow = function(callback) { + setTimeout(function() { + Util.exec(callback, 'hello'); + }, 10); + }, + funcFast = function(callback) { + setTimeout(function() { + Util.exec(callback, 'world'); + }, 1); + }; + + Util.asyncCall([funcSlow, funcFast], function(hello, world) { + WORD.should.equal(hello + ' ' + world); + }); + }); + + }); + }); })();