summaryrefslogtreecommitdiff
path: root/test/test-async.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/test-async.js')
-rwxr-xr-xtest/test-async.js57
1 files changed, 57 insertions, 0 deletions
diff --git a/test/test-async.js b/test/test-async.js
index ff401e7..0cb7bb0 100755
--- a/test/test-async.js
+++ b/test/test-async.js
@@ -1711,6 +1711,34 @@ exports['doUntil'] = function (test) {
);
};
+exports['doUntil callback params'] = function (test) {
+ var call_order = [];
+ var count = 0;
+ async.doUntil(
+ function (cb) {
+ debugger
+ call_order.push(['iterator', count]);
+ count++;
+ cb(null, count);
+ },
+ function (c) {
+ call_order.push(['test', c]);
+ return (c == 5);
+ },
+ function (err) {
+ test.same(call_order, [
+ ['iterator', 0], ['test', 1],
+ ['iterator', 1], ['test', 2],
+ ['iterator', 2], ['test', 3],
+ ['iterator', 3], ['test', 4],
+ ['iterator', 4], ['test', 5]
+ ]);
+ test.equals(count, 5);
+ test.done();
+ }
+ );
+};
+
exports['whilst'] = function (test) {
var call_order = [];
@@ -1769,6 +1797,35 @@ exports['doWhilst'] = function (test) {
);
};
+exports['doWhilst callback params'] = function (test) {
+ var call_order = [];
+
+ var count = 0;
+ async.doWhilst(
+ function (cb) {
+ call_order.push(['iterator', count]);
+ count++;
+ cb(null, count);
+ },
+ function (c) {
+ call_order.push(['test', c]);
+ return (c < 5);
+ },
+ function (err) {
+ debugger
+ test.same(call_order, [
+ ['iterator', 0], ['test', 1],
+ ['iterator', 1], ['test', 2],
+ ['iterator', 2], ['test', 3],
+ ['iterator', 3], ['test', 4],
+ ['iterator', 4], ['test', 5]
+ ]);
+ test.equals(count, 5);
+ test.done();
+ }
+ );
+};
+
exports['queue'] = function (test) {
var call_order = [],
delays = [160,80,240,80];