mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-20 18:18:56 +00:00
feature(util) asyncCall: add test
This commit is contained in:
parent
f41f3974a4
commit
b6d8b1a297
1 changed files with 21 additions and 0 deletions
|
|
@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
})();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue