While this works well for small examples like this, it is often necessary to set up a more complex state before testing selectors and mutations. The simplest way to do this is by calling
.set() on your store before you run your test and then then reset your application state before each test is run.
Another way to test mutations specifically is to use the
partialMutation helper function. This enables you to call your mutation with a partial state instead of needing to set up your whole application state. This can be useful when your application state is very complex.