-
Notifications
You must be signed in to change notification settings - Fork 47
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
Apply aggregation for single-view charts #121
Apply aggregation for single-view charts #121
Conversation
Due to a mistake, the aggregation method was invoked only on the new multiview charts but not on single-view charts. With this change, single-view charts are handled like multiview charts with only one view. This fixes the aggregation issue, makes things more consistent, and cleans up the code.
We should write a unit test for this so we don't regress in the future 😄 |
@filmaj: Good idea. Don’t know why I didn’t think about a unit test earlier. I’ll write one 👍. |
Writing unit tests for this turns out not to be straightforward. Find my work-in-progress unit tests in this separate branch. Let’s first assume that we want to have a DOM-based unit test in place, as I sketched in that branch. Then, we run into the following difficulties:
We could also question whether to use actual DOM for this at all. Instead, we could change the @filmaj: Do you see how we could get this tested elegantly? |
@pluehne I have created what I think is the scaffold for a unit test for this on my fork (same branch name): https://github.com/filmaj/hubble/tree/patrick/fix-aggregation-in-pull-request-usage-chart My approach short-circuits some of the assumptions you wrote out:
Hopefully my test scaffold helps point you in the right direction. Let me know if you have more questions. |
One more thing: as to how to assert / set expectations on changing state inside the
This is all assuming I'm understanding what's going on here properly ;) |
@filmaj: Thanks for your helpful replies! I won’t have the time to look at this until Monday, but I’m sure your scaffold will bring me on the right track 😄! Just one minor thing, I recall that using |
Hmm, I wouldn't expect that. Running my test scaffold does not yield any warnings. Perhaps that was outside of an |
@filmaj: Note that I added |
Ah yes, the linting fails if I remove it from the globals list. I think the better solution for that is to add the |
@filmaj: Cool, that’s what I had been looking for the other day. I didn’t find that option in the documentation immediately, and I gave up too early as it seems 😄. |
The docs are big. StackOverflow is your friend 😉 |
I've updated my branch to add that change, btw. |
Cool, will continue looking at this in a few days! |
@filmaj: We merged this without the unit test for the time being. I have looked into your suggestions, and I think that too much work is involved for testing such a simple property. As we finally wanted the fix to be available, we merged this pull request, but I’ll keep the unit test on my to-do list and may come back to it later. Thanks for your explanations on how this could be tested, they may be useful at some point! |
Due to a mistake (see #120), the aggregation method was invoked only on the new multiview charts but not on single-view charts. With this change, single-view charts are handled like multiview charts with only one view. This fixes the aggregation issue, makes things more consistent, and cleans up the code.
Fixes #120.