summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlexander Early <aearly@fluid.com>2015-05-25 15:08:00 -0700
committerAlexander Early <aearly@fluid.com>2015-05-25 15:08:00 -0700
commit7c7326b3892774641b4258f7207842ee8846fdd2 (patch)
tree5054eac2b470d74b766f30765d6efae7341b7232 /test
parentaba3e0c1af87f0f89bbddb6d3a2c56ffb9176c9b (diff)
downloadasync-ensure_async.tar.gz
use ensureAsync with forever. Fixes #622ensure_async
Diffstat (limited to 'test')
-rwxr-xr-xtest/test-async.js26
1 files changed, 24 insertions, 2 deletions
diff --git a/test/test-async.js b/test/test-async.js
index 6797afe..eba90e9 100755
--- a/test/test-async.js
+++ b/test/test-async.js
@@ -80,8 +80,10 @@ function getFunctionsObject(call_order) {
};
}
-exports['forever'] = function (test) {
- test.expect(1);
+exports['forever'] = {
+
+'async': function (test) {
+ test.expect(2);
var counter = 0;
function addOne(callback) {
counter++;
@@ -94,8 +96,28 @@ exports['forever'] = function (test) {
}
async.forever(addOne, function (err) {
test.equal(err, 'too big!');
+ test.equal(counter, 50);
test.done();
});
+},
+
+'sync': function (test) {
+ test.expect(2);
+ var counter = 0;
+ function addOne(callback) {
+ counter++;
+ if (counter === 50000) {
+ return callback('too big!');
+ }
+ callback();
+ }
+ async.forever(addOne, function (err) {
+ test.equal(err, 'too big!');
+ test.equal(counter, 50000);
+ test.done();
+ });
+}
+
};
exports['applyEach'] = function (test) {