Skip to content

Commit

Permalink
test(switch): fix odd-looking test with Promises
Browse files Browse the repository at this point in the history
For issue #1450.
  • Loading branch information
staltz authored and kwonoj committed Mar 18, 2016
1 parent e05f2d2 commit 34a0d3c
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions spec/operators/switch-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,15 +189,16 @@ describe('Observable.prototype.switch', () => {
});
});

it('should handle an observable of promises, where one rejects', (done: DoneSignature) => {
Observable.of<any>(Promise.resolve(1), Promise.reject(2), Promise.resolve(3))
it('should handle an observable of promises, where last rejects', (done: DoneSignature) => {
Observable.of<any>(Promise.resolve(1), Promise.resolve(2), Promise.reject(3))
.switch()
.subscribe((x: number) => {
expect(x).toBe(3);
.subscribe(() => {
done.fail();
}, (err: any) => {
expect(err).toBe(2);
}, () => {
expect(err).toBe(3);
done();
}, () => {
done.fail();
});
});

Expand Down

0 comments on commit 34a0d3c

Please sign in to comment.