Skip to content
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

Look into groupBy test #1743

Closed
benlesh opened this issue Jun 3, 2016 · 4 comments
Closed

Look into groupBy test #1743

benlesh opened this issue Jun 3, 2016 · 4 comments
Labels
help wanted Issues we wouldn't mind assistance with.

Comments

@benlesh
Copy link
Member

benlesh commented Jun 3, 2016

In #1701, there was a test I commented out because its intent wasn't entirely clear, but it was broken after changes to Subject (to match Rx4 semantics) effected the subjects returned by groupBy.

Here is the test:

// HACK: I found this test hard to grok, and it was broken after the Subject refactor.
// it('should return inners that when subscribed late exhibit hot behavior', () => {
// const values = {
// a: ' foo',
// b: ' FoO ',
// c: 'baR ',
// d: 'foO ',
// e: ' Baz ',
// f: ' qux ',
// g: ' bar',
// h: ' BAR ',
// i: 'FOO ',
// j: 'baz ',
// k: ' bAZ ',
// l: ' fOo '
// };
// const e1 = hot('-1--2--^-a-b-c-d-e-f-g-h-i-j-k-l-|', values);
// const e1subs = '^ !';
// const expected = '--v---w---x-y-----z-------|';
// const subv = ' ^ ';
// const v = '--------(d|)' ;
// const subw = ' ^ ';
// const w = '----------------(h|)' ;
// const subx = ' ^ ';
// const x = '----------------------(k|)' ;
// const suby = ' ^';
// const y = '------------------------------|';
// const subz = ' ^';
// const z = '--------------------------------|';
// const expectedGroups = {
// v: Rx.TestScheduler.parseMarbles(v, values),
// w: Rx.TestScheduler.parseMarbles(w, values),
// x: Rx.TestScheduler.parseMarbles(x, values),
// y: Rx.TestScheduler.parseMarbles(y, values),
// z: Rx.TestScheduler.parseMarbles(z, values)
// };
// const subscriptionFrames = {
// foo: Rx.TestScheduler.parseMarblesAsSubscriptions(subv).subscribedFrame,
// bar: Rx.TestScheduler.parseMarblesAsSubscriptions(subw).subscribedFrame,
// baz: Rx.TestScheduler.parseMarblesAsSubscriptions(subx).subscribedFrame,
// qux: Rx.TestScheduler.parseMarblesAsSubscriptions(suby).subscribedFrame,
// foo2: Rx.TestScheduler.parseMarblesAsSubscriptions(subz).subscribedFrame
// };
// const hasSubscribed = {};
// const source = e1
// .groupBy(
// (val: string) => val.toLowerCase().trim(),
// (val: string) => val,
// (group: any) => group.skip(2)
// )
// .map((group: any) => {
// const arr = [];
// const subscriptionFrame = hasSubscribed[group.key] ?
// subscriptionFrames[group.key + '2'] :
// subscriptionFrames[group.key];
// rxTestScheduler.schedule(() => {
// group
// .materialize()
// .map((notification: Rx.Notification<any>) => {
// return { frame: rxTestScheduler.frame, notification: notification };
// })
// .subscribe((value: any) => {
// arr.push(value);
// });
// hasSubscribed[group.key] = true;
// }, subscriptionFrame - rxTestScheduler.frame);
// return arr;
// });
// expectObservable(source).toBe(expected, expectedGroups);
// expectSubscriptions(e1.subscriptions).toBe(e1subs);
// });

We need to capture it's purpose and drop, refactor or rewrite the test as necessary.

cc/ @staltz

@benlesh benlesh added help wanted Issues we wouldn't mind assistance with. priority: high labels Jun 3, 2016
@benlesh
Copy link
Member Author

benlesh commented Jun 17, 2016

Closing this issue as stale.

@benlesh benlesh closed this as completed Jun 17, 2016
@staltz staltz reopened this Jul 4, 2016
@staltz
Copy link
Member

staltz commented Jul 4, 2016

I'm reopening this as I'm now refactoring/rewriting it.

The purpose is: make sure that the inner Observables (GroupedObservables) emitted are hot Observables, backed by a Subject, so late subscribers lose past events.

Why it is broke after the Subject rework: because the group duration subscriber subscribes before the "late subscriber", and the duration subscriber is a TakeOperator, which means once it receives the second next, it completes the GroupedObservable before the late subscriber is able to get that next event.

I'm working on rewriting this test.

staltz added a commit to staltz/RxJSNext that referenced this issue Jul 4, 2016
staltz added a commit to staltz/RxJSNext that referenced this issue Jul 18, 2016
@staltz
Copy link
Member

staltz commented Jul 19, 2016

Closing because the PR was merged.

@staltz staltz closed this as completed Jul 19, 2016
@lock
Copy link

lock bot commented Jun 7, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help wanted Issues we wouldn't mind assistance with.
Projects
None yet
Development

No branches or pull requests

2 participants