Skip to content

Commit

Permalink
test(bufferToggle): add more subscription assertions for bufferToggle…
Browse files Browse the repository at this point in the history
… tests

Add subscription assertions on the closing Observable subscriptions made in bufferToggle. The
closing Observable subscriptions should be unsubscribed when the bufferToggle Observable is
unsubscribed.
  • Loading branch information
staltz authored and benlesh committed Dec 8, 2015
1 parent 5db1352 commit 83349df
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions spec/operators/bufferToggle-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,15 @@ describe('Observable.prototype.bufferToggle', function () {

it('should emit buffers using varying cold closings, outer unsubscribed early', function () {
var e1 = hot('--a--^---b---c---d---e---f---g---h------| ');
var unsub = ' ! ';
var subs = '^ ! ';
var subs = '^ ! ';
var e2 = cold('--x-----------y--------z---| ');
var closings = [
cold( '---------------s--| '),
cold( '----(s|) '),
cold( '---------------(s|)')];
var expected = '-----------------i ';
var csub0 = ' ^ ! ';
var expected = '----------- ';
var unsub = ' ! ';
var values = {
i: ['b','c','d','e']
};
Expand All @@ -138,6 +139,9 @@ describe('Observable.prototype.bufferToggle', function () {

expectObservable(result, unsub).toBe(expected, values);
expectSubscriptions(e1.subscriptions).toBe(subs);
expectSubscriptions(closings[0].subscriptions).toBe(csub0);
expectSubscriptions(closings[1].subscriptions).toBe([]);
expectSubscriptions(closings[2].subscriptions).toBe([]);
});

it('should propagate error thrown from closingSelector', function () {
Expand Down

0 comments on commit 83349df

Please sign in to comment.