-
-
Notifications
You must be signed in to change notification settings - Fork 15.2k
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
createStore tests review #1686
createStore tests review #1686
Conversation
Hmm, I'm not sure we need this. I think my biggest issue is the meta-programming that puts things related to a test in a different part of the file. Thank you for your contributions, though! |
Could you please point out which lines of meta-programming are you referring to? I think there were a number of good points among the proposed commits to make tests better and clearer to be read. |
They are mainly style changes. Nothing affecting coverage or comprehension. |
Ok, I now see what you mean with "meta-programming".
You could also compare the list of tests used here to confirm there is no coherence among all these tests trying to ensure exceptions are thrown in case non-functions are used for parameters requiring function. I think this could be seen as an improvement on tests' coverage, as well as a way to improve tests readability. In my opinion also changing from: const listenerA = expect.createSpy(() => {}) to: const listenerA = createSpy() (see also docs for expect.createSpy which takes no parameters...) or from: const listenerB = expect.createSpy(() => {})
const unSubB = store.subscribe(() => {
listenerB()
unSubB()
}) to: const listenerB = createSpy().andCall(() => unSubB())
const unSubB = store.subscribe(listenerB) makes the code leaner cleaner, and more correct. |
I had a chance to look at some tests while working at #1626 and noticed there could be room to make them cleaner and more organized (at least from my point of view...).
This is a first pass on the createStore.spec.js file.
Let me know if this kind of review could be of interest and I'll try to complete it also on the other files.
P.S. it could be easier to follow the changes commit by commit, rather than looking at the final result directly.