summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraeme Yeates <yeatesgraeme@gmail.com>2016-07-12 11:16:15 -0400
committerGraeme Yeates <yeatesgraeme@gmail.com>2016-07-12 11:16:15 -0400
commit0b5b8b73d9fe5303cce1b11567c92ab21d5d9ed1 (patch)
tree64c6b48d21e89cffff41d01799ad5fda7953a03f
parent4bf860be31f6ece479df63316db3c2b0cbc97739 (diff)
downloadasync-0b5b8b73d9fe5303cce1b11567c92ab21d5d9ed1.tar.gz
Ensure retry can resolve synchronously in fastest case
-rw-r--r--mocha_test/retry.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/mocha_test/retry.js b/mocha_test/retry.js
index bed7079..57b0093 100644
--- a/mocha_test/retry.js
+++ b/mocha_test/retry.js
@@ -147,4 +147,14 @@ describe("retry", function () {
done();
}));
});
+
+ // note this is a synchronous test ensuring retry is synchrnous in the fastest (most straightforward) case
+ it('retry calls fn immediately and will call callback if successful', function() {
+ function fn(callback) {
+ callback(null, {a: 1});
+ }
+ async.retry(5, fn, function(err, result) {
+ expect(result).to.be.eql({a: 1});
+ });
+ })
});