fix(q): resolve all of nothing to nothing

$q.all([]) no longer throws exception and resolves to empty array []
This commit is contained in:
Misko Hevery
2012-03-23 13:31:20 -07:00
parent 5390fb37d2
commit ac75079e21
2 changed files with 21 additions and 9 deletions

View File

@@ -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();