Basic Reducer Test
Explore how to write basic tests for Redux reducers by checking that state updates correctly when actions like adding a recipe are dispatched. Understand reducer idempotency and create tests that ensure consistent and maintainable state changes.
We'll cover the following...
We'll cover the following...
Testing reducers is similar to testing action creators because reducers are idempotent. This means that it will return the same new state every time given a state and an action. This makes reducer tests very easy to write, as we simply need to call the reducer with different combinations of input to verify the correctness of the output.
Basic reducer test
For our test, we can create a very crude reducer that handles a single ADD_RECIPE action and whose state is ...