Skip to content

Commit

Permalink
test(skip): add test against breaking unsubscription chain
Browse files Browse the repository at this point in the history
For issue #875.
  • Loading branch information
staltz authored and kwonoj committed Dec 8, 2015
1 parent aa66e7e commit d2bd860
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions spec/operators/skip-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,21 @@ describe('Observable.prototype.skip()', function () {
expectSubscriptions(source.subscriptions).toBe(subs);
});

it('should not break unsubscription chains when result is unsubscribed explicitly', function () {
var source = hot('--a--b--c--d--e--|');
var subs = '^ ! ';
var expected = '--------c-- ';
var unsub = ' ! ';

var result = source
.mergeMap(function (x) { return Observable.of(x); })
.skip(2)
.mergeMap(function (x) { return Observable.of(x); });

expectObservable(result, unsub).toBe(expected);
expectSubscriptions(source.subscriptions).toBe(subs);
});

it('should raise error if skip count is more than actual number of emits and source raises error', function () {
var source = hot('--a--b--c--d--#');
var subs = '^ !';
Expand Down

0 comments on commit d2bd860

Please sign in to comment.