You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be really useful to have a section in the readme with an example of how to write unit tests for selectors. The obvious strategy is to have two functions for every selector; the selector and the pure function:
export const getAddition = (a, b) => a + b // test this one
export const additionSelector = createSelector([ aSelector, bSelector ], getAddition);
However, this can be quite annoying because (at least in my app) the pure functions are almost always only used within the selector so it means having to figure out a naming strategy, be extra careful for typos, have a bigger API footprint, etc. However, if testing the selectors directly are we going to run into subtle problems with memoization or anything like that? Does testing selectors directly even work as a concept?
Any advice appreciated!
The text was updated successfully, but these errors were encountered:
I have been testing selectors directly. I'm currently in the middle of rewriting the documentation at the moment, I'll get my thoughts straight on this topic and add them as a section to the readme as suggested. Keep an eye on the 1.0.0_WIP branch in the next few days.
It would be really useful to have a section in the readme with an example of how to write unit tests for selectors. The obvious strategy is to have two functions for every selector; the selector and the pure function:
However, this can be quite annoying because (at least in my app) the pure functions are almost always only used within the selector so it means having to figure out a naming strategy, be extra careful for typos, have a bigger API footprint, etc. However, if testing the selectors directly are we going to run into subtle problems with memoization or anything like that? Does testing selectors directly even work as a concept?
Any advice appreciated!
The text was updated successfully, but these errors were encountered: