Skip to content
Permalink
Browse files

fix(forkJoin): test for object literal (#4741)

* test(forkJoin): add failing test for #4737

* fix(forkJoin): test for object literal not observable

Closes #4737.
  • Loading branch information...
cartant authored and benlesh committed May 2, 2019
1 parent 1dc09e9 commit c11e1b3579ec748b33a1a402fd2366aa74720165
Showing with 14 additions and 1 deletion.
  1. +13 −0 spec/observables/forkJoin-spec.ts
  2. +1 −1 src/internal/observable/forkJoin.ts
@@ -504,5 +504,18 @@ describe('forkJoin', () => {
expectSubscriptions(e1.subscriptions).toBe(e1subs);
expectSubscriptions(e2.subscriptions).toBe(e2subs);
});

it('should accept promise as the first arg', done => {
const e1 = forkJoin(Promise.resolve(1));
const values: number[][] = [];

e1.subscribe({
next: x => values.push(x),
complete: () => {
expect(values).to.deep.equal([[1]]);
done();
}
});
});
});
});
@@ -147,7 +147,7 @@ export function forkJoin(
return forkJoinInternal(first, null);
}
// TODO(benlesh): isObservable check will not be necessary when deprecated path is removed.
if (isObject(first) && !isObservable(first)) {
if (isObject(first) && Object.getPrototypeOf(first) === Object.prototype) {
const keys = Object.keys(first);
return forkJoinInternal(keys.map(key => first[key]), keys);
}

0 comments on commit c11e1b3

Please sign in to comment.
You can’t perform that action at this time.