We'll have to test the reducers and mappings, so let's start by thinking about how you would test a reducer. There are two key things to verify: first, that given an input state, it produces a correct output state, and second, that the reducer doesn't modify the original state. The first condition is pretty obvious, but the second can easily be missed – and a reducer that modifies the current state can produce hard-to-find bugs.
Let's look at how we could test our countries and regions application's reducer. First, since all tests are analog, we'll just see a couple of them, for two of all the possible actions – but of course, you want to test all of the actions, right? We'll also include another test to verify that for unknown ...