diff options
-rw-r--r-- | lib/async.js | 2 | ||||
-rwxr-xr-x | test/test-async.js | 13 |
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; |