Skip to content

Commit c11e1b3

Browse files
cartantbenlesh
authored andcommittedMay 2, 2019
fix(forkJoin): test for object literal (#4741)
* test(forkJoin): add failing test for #4737 * fix(forkJoin): test for object literal not observable Closes #4737.
1 parent 1dc09e9 commit c11e1b3

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed
 

‎spec/observables/forkJoin-spec.ts

+13
Original file line numberDiff line numberDiff line change
@@ -504,5 +504,18 @@ describe('forkJoin', () => {
504504
expectSubscriptions(e1.subscriptions).toBe(e1subs);
505505
expectSubscriptions(e2.subscriptions).toBe(e2subs);
506506
});
507+
508+
it('should accept promise as the first arg', done => {
509+
const e1 = forkJoin(Promise.resolve(1));
510+
const values: number[][] = [];
511+
512+
e1.subscribe({
513+
next: x => values.push(x),
514+
complete: () => {
515+
expect(values).to.deep.equal([[1]]);
516+
done();
517+
}
518+
});
519+
});
507520
});
508521
});

‎src/internal/observable/forkJoin.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ export function forkJoin(
147147
return forkJoinInternal(first, null);
148148
}
149149
// TODO(benlesh): isObservable check will not be necessary when deprecated path is removed.
150-
if (isObject(first) && !isObservable(first)) {
150+
if (isObject(first) && Object.getPrototypeOf(first) === Object.prototype) {
151151
const keys = Object.keys(first);
152152
return forkJoinInternal(keys.map(key => first[key]), keys);
153153
}

0 commit comments

Comments
 (0)
Please sign in to comment.