Softwerkskammer

 

React-Redux Test-Strategy

As an intro to get everybody on-board for the testing discussion Christoph Haefner presented Nicole Rauchs slides explaining React-Redux (there is also a video of here doing it herself).

After the introduction we took a deeper look at a possible test setup for testing React-Redux apps. Jest, developed by Facebook, was presented as a possible test-runner. With a build-in option to easily enable the creation of a coverage report, and snapshots test to easier test UIs, it's a good pick to start with.
Additionally we added Enzyme, developed by AirBnB, to the mix. This library provides a great API to write assertions on UI criterias (e.g. a rendered component should have a exactly three elements in a list).

The example application used to discuss the test-strategies was "fml" currently developed as playaround-project by Christoph Haefner.
While going through one of the container-component tests, which was particularly interesting as it tests a user-interaction scenario, we had a hart time figuring out why the tests works.
We couldn't quite wrap our head around how Enzymes second parameter on the simulate method is handled.

Thanks to all participant for great discussions and insights. I definitely learned a lot!