Sometimes we want to test our Redux reducers to make sure they work as expected. In this lesson we will walk through setting up some Redux reducer tests for common situations and edge cases.
Just curious as to the reason why stateBefore
needs to be a function rather than a const
. Is that intentional?
No reason, a variable would work great :)
solid series!
@Trevor good course! and a much needed one, thanks.
Think needs to be updated for Enzyme. Also reducers should not mutate the state. The current tests are not checking and enforcing the no mutation of state. You need to perhaps assign the results of the function call to a const and then deep freeze the const.