diff --git a/spec/operators/catch-spec.js b/spec/operators/catch-spec.js index 4610adf1ad..ef30fe053b 100644 --- a/spec/operators/catch-spec.js +++ b/spec/operators/catch-spec.js @@ -24,7 +24,7 @@ describe('Observable.prototype.catch()', function () { }); it('should catch error and replace it with a cold Observable', function () { - var e1 = hot('--a--b--#----| '); + var e1 = hot('--a--b--# '); var e1subs = '^ ! '; var e2 = cold( '1-2-3-4-5-|'); var e2subs = ' ^ !'; @@ -39,9 +39,9 @@ describe('Observable.prototype.catch()', function () { it('should allow unsubscribing explicitly and early', function () { var e1 = hot('--1-2-3-4-5-6---#'); - var unsub = ' ! '; var e1subs = '^ ! '; var expected = '--1-2-3- '; + var unsub = ' ! '; var result = e1.catch(function () { return Observable.of('X', 'Y', 'Z'); @@ -51,6 +51,23 @@ describe('Observable.prototype.catch()', function () { expectSubscriptions(e1.subscriptions).toBe(e1subs); }); + it('should not break unsubscription chain when unsubscribed explicitly', function () { + var e1 = hot('--1-2-3-4-5-6---#'); + var e1subs = '^ ! '; + var expected = '--1-2-3- '; + var unsub = ' ! '; + + var result = e1 + .mergeMap(function (x) { return Observable.of(x); }) + .catch(function () { + return Observable.of('X', 'Y', 'Z'); + }) + .mergeMap(function (x) { return Observable.of(x); }); + + expectObservable(result, unsub).toBe(expected); + expectSubscriptions(e1.subscriptions).toBe(e1subs); + }); + it('should catch error and replace it with a hot Observable', function () { var e1 = hot('--a--b--#----| '); var e1subs = '^ ! ';