Chapter 16. Unit testing React with Jest

This chapter covers

  • Reasons to use Jest
  • Unit testing with Jest
  • UI testing with Jest and TestUtils

In modern software engineering, testing is important. It’s at least as important as using Agile methods, writing well-documented code, and having enough coffee on hand—sometimes even more so. Proper testing will save you from many hours of debugging later. The code isn’t an asset, it’s a liability, so your goal is to make it as easy to maintain as possible.

Code is a liability?

Googling the phrase “Code isn’t an asset, it’s a liability” gives 191 million results, which makes it hard to pinpoint its origins. Although I can’t find an author, I can tell you the gist of the idea: when you write ...

Get React Quickly now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.