Skip to content

Commit

Permalink
test(takeUntil): add test against breaking unsubscription chain
Browse files Browse the repository at this point in the history
Relates to ReactiveX#875.
  • Loading branch information
figueredo committed Dec 7, 2015
1 parent d5adbd4 commit 39d7699
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions spec/operators/takeUntil-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,4 +171,22 @@ describe('Observable.prototype.takeUntil()', function () {
expectSubscriptions(e1.subscriptions).toBe(e1subs);
expectSubscriptions(e2.subscriptions).toBe(e2subs);
});

it('should not break unsubscription chain when unsubscribed explicitly', function () {
var e1 = hot('--a--b--c--d--e--f--g--|');
var e1subs = '^ ! ';
var e2 = hot('-------------z--| ');
var e2subs = '^ ! ';
var unsub = ' ! ';
var expected = '--a--b-- ';

var result = e1
.mergeMap(function (x) { return Observable.of(x); })
.takeUntil(e2)
.mergeMap(function (x) { return Observable.of(x); });

expectObservable(result, unsub).toBe(expected);
expectSubscriptions(e1.subscriptions).toBe(e1subs);
expectSubscriptions(e2.subscriptions).toBe(e2subs);
});
});

0 comments on commit 39d7699

Please sign in to comment.