summaryrefslogtreecommitdiff
path: root/mocha_test/retryable.js
diff options
context:
space:
mode:
Diffstat (limited to 'mocha_test/retryable.js')
-rw-r--r--mocha_test/retryable.js22
1 files changed, 20 insertions, 2 deletions
diff --git a/mocha_test/retryable.js b/mocha_test/retryable.js
index 7147269..48d9ee9 100644
--- a/mocha_test/retryable.js
+++ b/mocha_test/retryable.js
@@ -16,9 +16,27 @@ describe('retryable', function () {
expect(calls).to.equal(3);
done();
});
+ });
+
+ it('basics with error test function', function (done) {
+ var calls = 0;
+ var special = 'special';
+ var opts = {
+ errorFilter: function(err) {
+ return err == special;
+ }
+ };
+ var retryableTask = async.retryable(opts, function (arg, cb) {
+ calls++;
+ expect(arg).to.equal(42);
+ cb(calls === 3 ? 'fail' : special);
+ });
- setTimeout(function () {
- }, 15);
+ retryableTask(42, function (err) {
+ expect(err).to.equal('fail');
+ expect(calls).to.equal(3);
+ done();
+ });
});
it('should work as an embedded task', function(done) {