Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(forkJoin): test for object literal #4741

Merged
merged 2 commits into from
May 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions spec/observables/forkJoin-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
});
});
});
});
2 changes: 1 addition & 1 deletion src/internal/observable/forkJoin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down