diff options
author | Alexander Early <alexander.early@gmail.com> | 2016-03-11 20:25:01 -0800 |
---|---|---|
committer | Alexander Early <alexander.early@gmail.com> | 2016-03-11 20:25:01 -0800 |
commit | ffa7b0fe282e6edd41c52d2120f44ce335ee7701 (patch) | |
tree | 3f85b42bc60a6117138d878e9236cdd943f2ab2b | |
parent | 5e54bda8a7c5da32f77b2686f1aa023f1c595f1f (diff) | |
download | async-ffa7b0fe282e6edd41c52d2120f44ce335ee7701.tar.gz |
re-enable test, handle omitted retry options
-rw-r--r-- | lib/retryable.js | 13 | ||||
-rw-r--r-- | mocha_test/retryable.js | 3 |
2 files changed, 12 insertions, 4 deletions
diff --git a/lib/retryable.js b/lib/retryable.js index 3d73f79..26fa609 100644 --- a/lib/retryable.js +++ b/lib/retryable.js @@ -2,10 +2,19 @@ import retry from './retry'; import rest from 'lodash/rest'; export default function (opts, task) { + if (!task) { + task = opts; + opts = null; + } return rest(function (args) { var callback = args.pop(); - retry(opts, function (cb) { + + function taskFn(cb) { task.apply(null, args.concat([cb])); - }, callback); + } + + if (opts) retry(opts, taskFn, callback); + else retry(taskFn, callback); + }); } diff --git a/mocha_test/retryable.js b/mocha_test/retryable.js index 8cad403..8141629 100644 --- a/mocha_test/retryable.js +++ b/mocha_test/retryable.js @@ -21,8 +21,7 @@ describe('retryable', function () { }, 15); }); - // TODO: re-enable when auto's args are swapped - it.skip('should work as an embedded task', function(done) { + it('should work as an embedded task', function(done) { var retryResult = 'RETRY'; var fooResults; var retryResults; |