React Testing: Redux Reducers

InstructorTrevor Miller

Share this video with your friends

Send Tweet

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.

Enrique
~ 8 years ago

Just curious as to the reason why stateBefore needs to be a function rather than a const. Is that intentional?

Trevor Millerinstructor
~ 8 years ago

No reason, a variable would work great :)

Shawn
~ 7 years ago

solid series!

Mickey
~ 6 years ago

@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.