From 8dc0851a3411521c1250472c0fe15fe48b137221 Mon Sep 17 00:00:00 2001 From: Andre Staltz Date: Sat, 5 Dec 2015 13:37:40 +0200 Subject: [PATCH] test(retry): add test against breaking unsubscription chains Add test for retry() operator to verify that unsubscription chains are not broken when unsubscribe happens. For issue #875. --- spec/operators/retry-spec.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/spec/operators/retry-spec.js b/spec/operators/retry-spec.js index 0ca7daf9bc..0212c24b39 100644 --- a/spec/operators/retry-spec.js +++ b/spec/operators/retry-spec.js @@ -173,4 +173,20 @@ describe('Observable.prototype.retry()', function () { expectObservable(result, unsub).toBe(expected); expectSubscriptions(source.subscriptions).toBe(subs); }); + + it('should not break unsubscription chain when unsubscribed explicitly', function () { + var source = cold('--1-2-3-#'); + var subs = ['^ ! ', + ' ^ ! ']; + var expected = '--1-2-3---1-2-'; + var unsub = ' ! '; + + var result = source + .mergeMap(function (x) { return Observable.of(x); }) + .retry(100) + .mergeMap(function (x) { return Observable.of(x); }); + + expectObservable(result, unsub).toBe(expected); + expectSubscriptions(source.subscriptions).toBe(subs); + }); }); \ No newline at end of file