summaryrefslogtreecommitdiff
path: root/mocha_test/setImmediate.js
diff options
context:
space:
mode:
Diffstat (limited to 'mocha_test/setImmediate.js')
-rw-r--r--mocha_test/setImmediate.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/mocha_test/setImmediate.js b/mocha_test/setImmediate.js
new file mode 100644
index 0000000..854111a
--- /dev/null
+++ b/mocha_test/setImmediate.js
@@ -0,0 +1,24 @@
+var async = require('../lib');
+var expect = require('chai').expect;
+
+describe("setImmediate", function () {
+
+ it('basics', function(done){
+ var call_order = [];
+ async.setImmediate(function(){call_order.push('two');});
+ call_order.push('one');
+
+ setTimeout(function(){
+ expect(call_order).to.eql(['one','two']);
+ done();
+ }, 25);
+ });
+
+ it("extra args", function (done) {
+ async.setImmediate(function (a, b, c) {
+ expect([a, b, c]).to.eql([1, 2, 3]);
+ done();
+ }, 1, 2, 3);
+ });
+
+});