Permalink
Browse files

readme: travis badge

test: random order test
  • Loading branch information...
1 parent 8e2e7cb commit 1411494161823f6907b0e01bd2b9e8917928d2a4 @indutny committed Jun 18, 2012
Showing with 20 additions and 1 deletion.
  1. +1 −1 README.md
  2. +19 −0 test/load-test.js
View
@@ -1,3 +1,3 @@
-# deferTick([function])
+# deferTick([function]) [![Build Status](https://secure.travis-ci.org/indutny/defer-tick.png)](http://travis-ci.org/indutny/defer-tick)
...
View
@@ -1,5 +1,6 @@
var assert = require('assert'),
async = require('async'),
+ fs = require('fs'),
deferTick = require('..');
describe('nextTick()', function() {
@@ -12,4 +13,22 @@ describe('nextTick()', function() {
deferTick(callback);
}, callback);
});
+
+ it('should fire callback after fs action', function(callback) {
+ function loop(num, callback) {
+ var i = 0;
+ fs.stat('/dev/null', function() {
+ i++;
+ });
+
+ deferTick(function() {
+ i++;
+ if (i == 2) return callback();
+ if (num < 3000) return loop(num + 1, callback);
+ assert(num < 3000);
+ });
+ };
+
+ loop(0, callback);
+ });
});

0 comments on commit 1411494

Please sign in to comment.