Skip to content
Browse files

Add test for batch callbacks

  • Loading branch information...
1 parent fc70dae commit 9639374743870c77fc18da03a9b37f52c8cd5ab5 @DanielBaulig committed Mar 17, 2012
Showing with 38 additions and 0 deletions.
  1. +38 −0 test/first.test.js
View
38 test/first.test.js
@@ -106,3 +106,41 @@ exports.testFlow = function (t) {
t.done();
});
};
+
+exports.testBatch = function (t) {
+ t.expect(14);
+ var n = 0;
+ first(function() {
+ t.equal(++n, 1);
+ this();
+ }).then(function() {
+ t.ok(++n > 1);
+ t.ok(n < 4);
+ this();
+ }).whilst(function() {
+ t.ok(++n > 1);
+ t.ok(n < 4);
+ this();
+ }).then(function() {
+ t.equal(++n, 4);
+ this();
+ }, function() {
+ t.equal(++n, 5);
+ this();
+ }).then(function() {
+ t.ok(++n > 5);
+ t.ok(n < 9);
+ this();
+ }).whilst(function() {
+ t.ok(++n > 5);
+ t.ok(n < 9);
+ this();
+ }, function () {
+ t.ok(++n > 5);
+ t.ok(n < 9);
+ this();
+ }).then(function () {
+ t.equal(++n, 9);
+ t.done();
+ });
+};

0 comments on commit 9639374

Please sign in to comment.
Something went wrong with that request. Please try again.