-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(buffer): cleanup notifier subscription when unsubscribed #537
Conversation
Good catch. Should we also add a test for that? |
Would be better to have, bit unsure how to design test case for this. @staltz any suggestions? |
Looks like we need to add tests for the work? Coveralls is complaining on this one, @kwonoj |
Yes I agree, as asked above bit unsure how to design test case for this. May I borrow some tips from you for insight? |
@kwonoj here's a draft: it('should', function () {
var a = hot('--1--2--^--3--4--5---6----7--8--9---0---|');
var unsub = ' ! ';
var subs = '^ ! ';
var b = hot('--------^--a-------b---cd| ');
var bsubs = '^ ! '; // <-----------------
var expected = '---a-------b--- ';
var expectedValues = {
a: ['3'],
b: ['4', '5']
};
expectObservable(a.buffer(b), unsub).toBe(expected, expectedValues);
expectSubscriptions(a.subscriptions).toBe(subs);
expectSubscriptions(b.subscriptions).toBe(bsubs); // <------------------
}); |
@staltz Appreciate for help! I'll try to add those test cases. |
Updated PR by copy-paste of @staltz 's help 😁 |
Looks good. I wonder why Coveralls is reporting less coverage (by -0.01%, negligible in my opinion). |
Code snippet
emits buffered elements like
This PR let buffer unsubscribes closingNotifier to avoid above issue.