summaryrefslogtreecommitdiff
path: root/mocha_test
diff options
context:
space:
mode:
authorAlex Early <alexander.early@gmail.com>2016-04-07 13:47:21 -0700
committerAlex Early <alexander.early@gmail.com>2016-04-07 13:47:21 -0700
commitd77e19a59a9aac088cae964507cd56f743ccc834 (patch)
tree0438f52aecc300a60fa2c2e2d27e42cbc1ec78fd /mocha_test
parent6ad036d07add9aa24a26b831cd211041d3b681f6 (diff)
parent3e33843000cba809a52364f10cbb48b385025b46 (diff)
downloadasync-d77e19a59a9aac088cae964507cd56f743ccc834.tar.gz
Merge pull request #1100 from steverobb/autoInjectPR
Fix for autoInject argument injection into final callback
Diffstat (limited to 'mocha_test')
-rw-r--r--mocha_test/autoInject.js22
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();
+ }]);
+ });
+
});