summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraeme Yeates <yeatesgraeme@gmail.com>2015-07-20 00:02:09 -0400
committerGraeme Yeates <yeatesgraeme@gmail.com>2015-07-20 00:02:24 -0400
commitade570d379f7ad5c35fb50c1166c6b25a347cddc (patch)
treea68f45bfdbbaef79abc5f0b69c26cafdf6b663a2
parentf7edbd5afa0c4279d53095bbc4e9991bf519fa04 (diff)
downloadasync-ade570d379f7ad5c35fb50c1166c6b25a347cddc.tar.gz
Add test coverage of retry errors
-rw-r--r--lib/async.js2
-rwxr-xr-xtest/test-async.js13
2 files changed, 14 insertions, 1 deletions
diff --git a/lib/async.js b/lib/async.js
index f3cfb80..f88f1cd 100644
--- a/lib/async.js
+++ b/lib/async.js
@@ -593,7 +593,7 @@
acc.times = parseInt(t.times, 10) || DEFAULT_TIMES;
acc.interval = parseInt(t.interval, 10) || DEFAULT_INTERVAL;
} else {
- throw new Error('Unsupported argument type for \'times\': ' + typeof(t));
+ throw new Error('Unsupported argument type for \'times\': ' + typeof t);
}
}
diff --git a/test/test-async.js b/test/test-async.js
index fdb949b..aeaea5b 100755
--- a/test/test-async.js
+++ b/test/test-async.js
@@ -728,6 +728,19 @@ exports['retry when all attempts succeeds'] = function(test) {
});
};
+exports['retry fails with invalid arguments'] = function(test) {
+ test.throws(function() {
+ async.retry("");
+ });
+ test.throws(function() {
+ async.retry();
+ });
+ test.throws(function() {
+ async.retry(function() {}, 2, function() {});
+ });
+ test.done();
+};
+
exports['retry with interval when all attempts succeeds'] = function(test) {
var times = 3;
var interval = 500;