Skip to content

Commit

Permalink
test(retry): add test against breaking unsubscription chains
Browse files Browse the repository at this point in the history
Add test for retry() operator to verify that unsubscription chains are not broken when unsubscribe
happens.

For issue #875.
  • Loading branch information
staltz authored and benlesh committed Dec 8, 2015
1 parent d9a7328 commit d3cf59c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions spec/operators/retry-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});

0 comments on commit d3cf59c

Please sign in to comment.