Skip to content

Commit ade570d

Browse files
committed
Add test coverage of retry errors
1 parent f7edbd5 commit ade570d

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

lib/async.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@
593593
acc.times = parseInt(t.times, 10) || DEFAULT_TIMES;
594594
acc.interval = parseInt(t.interval, 10) || DEFAULT_INTERVAL;
595595
} else {
596-
throw new Error('Unsupported argument type for \'times\': ' + typeof(t));
596+
throw new Error('Unsupported argument type for \'times\': ' + typeof t);
597597
}
598598
}
599599

test/test-async.js

+13
Original file line numberDiff line numberDiff line change
@@ -728,6 +728,19 @@ exports['retry when all attempts succeeds'] = function(test) {
728728
});
729729
};
730730

731+
exports['retry fails with invalid arguments'] = function(test) {
732+
test.throws(function() {
733+
async.retry("");
734+
});
735+
test.throws(function() {
736+
async.retry();
737+
});
738+
test.throws(function() {
739+
async.retry(function() {}, 2, function() {});
740+
});
741+
test.done();
742+
};
743+
731744
exports['retry with interval when all attempts succeeds'] = function(test) {
732745
var times = 3;
733746
var interval = 500;

0 commit comments

Comments
 (0)