O'Reilly logo

Flux Architecture by Adam Boduch

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Testing stores

In the previous section, we used Jest to test action creator functions. This wasn't much different from testing any other JavaScript function, except that Flux action creators need to somehow dispatch the actions they create to stores. Jest helps us achieve this by automatically mocking certain components, and it will certainly help us test our store components.

In this section, we'll look at testing the basic path of an action being dispatched to a store and the store emitting a change event. Then, we'll think about the initial store state and how this can lead to bugs that unit tests should be able to catch. Making all of this work is going to involve thinking about implementing testable store code, which is something we have yet ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required