summaryrefslogtreecommitdiff
path: root/mocha_test/apply.js
diff options
context:
space:
mode:
Diffstat (limited to 'mocha_test/apply.js')
-rw-r--r--mocha_test/apply.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/mocha_test/apply.js b/mocha_test/apply.js
new file mode 100644
index 0000000..18e5d12
--- /dev/null
+++ b/mocha_test/apply.js
@@ -0,0 +1,21 @@
+var async = require('../lib');
+var expect = require('chai').expect;
+
+describe('concat', function() {
+ it('apply', function(done) {
+ var fn = function(){
+ expect(Array.prototype.slice.call(arguments)).to.eql([1,2,3,4]);
+ };
+ async.apply(fn, 1, 2, 3, 4)();
+ async.apply(fn, 1, 2, 3)(4);
+ async.apply(fn, 1, 2)(3, 4);
+ async.apply(fn, 1)(2, 3, 4);
+ async.apply(fn)(1, 2, 3, 4);
+ expect(
+ async.apply(function(name){return 'hello ' + name;}, 'world')()
+ ).to.equal(
+ 'hello world'
+ );
+ done();
+ });
+});