Skip to content
 

Testing React
πŸ”—

In order to encourage people to support my work, I’ve decided to publish a TL;DR version of this chapter for the community. This will allow me to develop more content, so it’s a win-win really.

You can access the full chapter by buying a copy through Leanpub↗. It goes into detail, whereas the following should give you a rough idea of the chapter contents.

TL;DR
πŸ”—

  • Basic testing techniques include unit testing, acceptance testing, property based testing, and mutation testing.
  • Unit testing allows us to ascertain specific certain truths.
  • Acceptance testing allows us to test qualitative aspects of our system.
  • Property based testing (see QuickCheckβ†—) is more generic and allows us to cover a wider range of values more easily. These tests are more difficult to write, though.
  • Mutation testing makes it possible to test the tests. Unfortunately, it’s not a particularly popular technique with JavaScript yet.
  • Cesar Andreu’s web-appβ†— has a nice testing setup (Mocha/Karma/Istanbul).
  • Code coverage helps us to understand what parts of the code remain untested. It does not, however, give us any guarantees of the quality of our tests.
  • React Test Utilitiesβ†— give us a nice way to write unit tests for components. There are lighter APIs, such as jquense/react-testutil-queryβ†—.
  • Alt provides a good means for testing actionsβ†— and storesβ†—.
  • Testing provides you confidence. This will become particularly important as your codebase grows. It will become harder to break things inadvertently.

Buy the book↗ for more detail.

←Previous

Comments
πŸ”—