Skip to content

Commit

Permalink
fix(bufferTime): handle closing context when synchronously unsubscribed
Browse files Browse the repository at this point in the history
  • Loading branch information
kwonoj committed Jun 12, 2016
1 parent 0a6c4e8 commit 95970c3
Show file tree
Hide file tree
Showing 2 changed files with 250 additions and 230 deletions.
16 changes: 16 additions & 0 deletions spec/operators/bufferTime-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,4 +284,20 @@ describe('Observable.prototype.bufferTime', () => {
expectObservable(result).toBe(expected, values);
expectSubscriptions(e1.subscriptions).toBe(e1subs);
});

it('should not throw when subscription synchronously unsubscribed after emit', () => {
const e1 = hot('---a---b---c---d---e---f---g-----|');
const subs = '^ !';
const t = time( '----------|');
const expected = '----------w---------(x|)';
const values = {
w: ['a', 'b'],
x: ['c', 'd', 'e']
};

const result = e1.bufferTime(t, null, Number.POSITIVE_INFINITY, rxTestScheduler).take(2);

expectObservable(result).toBe(expected, values);
expectSubscriptions(e1.subscriptions).toBe(subs);
});
});
Loading

0 comments on commit 95970c3

Please sign in to comment.