From ac75079e2113949d5d64adbcf23d56f3cf295d41 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Fri, 23 Mar 2012 13:31:20 -0700 Subject: fix(q): resolve all of nothing to nothing $q.all([]) no longer throws exception and resolves to empty array [] --- test/service/qSpec.js | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test') diff --git a/test/service/qSpec.js b/test/service/qSpec.js index e592ab87..a230d1de 100644 --- a/test/service/qSpec.js +++ b/test/service/qSpec.js @@ -676,6 +676,14 @@ describe('q', function() { describe('all', function() { + it('should resolve all of nothing', function() { + var result; + q.all([]).then(function(r) { result = r; }); + mockNextTick.flush(); + expect(result).toEqual([]); + }); + + it('should take an array of promises and return a promise for an array of results', function() { var deferred1 = defer(), deferred2 = defer(); -- cgit v1.2.3