diff options
author | Steve Robb <softnfuzzyrobb@gmail.com> | 2016-04-06 02:40:15 +0100 |
---|---|---|
committer | Steve Robb <softnfuzzyrobb@gmail.com> | 2016-04-06 02:40:15 +0100 |
commit | b5bba26894d454183070c7e9f5cf456b05a6f1b3 (patch) | |
tree | 8d08d65bbfb1f6a25739a57f64151c3914c28b48 | |
parent | 33556e09a186e08557dc03b291d55ce5ee909ba2 (diff) | |
download | async-b5bba26894d454183070c7e9f5cf456b05a6f1b3.tar.gz |
Array results test.
-rw-r--r-- | mocha_test/autoInject.js | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/mocha_test/autoInject.js b/mocha_test/autoInject.js index 059c7ae..1408af9 100644 --- a/mocha_test/autoInject.js +++ b/mocha_test/autoInject.js @@ -44,8 +44,8 @@ describe('autoInject', function () { callback(null, 6); } }, - function(err, results){ - expect(results.task6).to.equal(6); + function(err, task6){ + expect(task6).to.equal(6); expect(callOrder).to.eql(['task2','task3','task6','task5','task1','task4']); done(); }); @@ -74,4 +74,22 @@ describe('autoInject', function () { }); }); + it('should work with array results', function (done) { + async.autoInject({ + task1: function (cb) { + cb(null, 1); + }, + task2: function (task3, cb) { + cb(null, 2); + }, + task3: function (cb) { + cb(null, 3); + } + }, ['task3', 'task1', function (err, task3, task1) { + expect(task1).to.equal(1); + expect(task3).to.equal(3); + done(); + }]); + }); + }); |