Skip to content

Commit

Permalink
test(catchError): add failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
cartant committed May 26, 2018
1 parent d7bfc9d commit 445dfe4
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion spec/operators/catch-spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect } from 'chai';
import { of, throwError, EMPTY, from } from 'rxjs';
import { concat, Observable, of, throwError, EMPTY, from } from 'rxjs';
import { catchError, map, mergeMap } from 'rxjs/operators';
import { TestScheduler } from 'rxjs/testing';
import * as sinon from 'sinon';
Expand Down Expand Up @@ -285,6 +285,21 @@ describe('catchError operator', () => {
});
});

it('should catch errors throw from within the constructor', () => {
// See https://github.com/ReactiveX/rxjs/issues/3740
const source = concat(
new Observable<string>(o => {
o.next('a');
throw 'kaboom';
}).pipe(
catchError(_ => of('b'))
),
of('c')
);
const expected = '(abc|)';
expectObservable(source).toBe(expected);
});

context('fromPromise', () => {
type SetTimeout = (callback: (...args: any[]) => void, ms: number, ...args: any[]) => NodeJS.Timer;

Expand Down

0 comments on commit 445dfe4

Please sign in to comment.