summaryrefslogtreecommitdiff
path: root/mocha_test/retryable.js
diff options
context:
space:
mode:
authorGraeme Yeates <yeatesgraeme@gmail.com>2016-08-08 09:51:08 -0400
committerGitHub <noreply@github.com>2016-08-08 09:51:08 -0400
commitff65da5bb3b14fc7ba4632859fa9a0eee73ae80c (patch)
tree51dd8638db6ce4a520b4ef6955251d19a63ef15d /mocha_test/retryable.js
parent8ea5ea8b9a229882e82e08287bb68a28fd4ecd2f (diff)
parent4367751bc420f4f279d83e8eae291708bf7990f6 (diff)
downloadasync-ff65da5bb3b14fc7ba4632859fa9a0eee73ae80c.tar.gz
Merge pull request #1261 from bojand/master
add filter option to retry() and retryable(). PR for #1256.
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) {