1. 8
    Unit Testing a Basic Redux Selector
    2m 18s

Unit Testing a Basic Redux Selector

InstructorJamund Ferguson

Share this video with your friends

Send Tweet

In a lot of ways plain selectors like we're testing here are extremely simple to reason about. The only thing that's a little tricky is even though they're often written side-by-side with a reducer, they accept the RootState instead of the reducer state. When writing these tests with TypeScript you often find yourself using as to cast partial state into full RootState type.

Here we're doubly nesting our describe blocks and it works great and makes our test output nicely formatted.