Skip to content

Commit

Permalink
test(take): 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 37df401
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions spec/operators/take-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,19 @@ describe('Observable.prototype.take()', function () {
expect(function () { Observable.range(0,10).take(-1); })
.toThrow(new Rx.ArgumentOutOfRangeError());
});

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

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

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

0 comments on commit 37df401

Please sign in to comment.