React TL;DR – a human filter for most useful tech content.

All posts

Test Driven Development (TDD) with React, React Testing Library, and Jest

A strategy for writing good test  

 

  • Write a test that fails (RED). This is to avoid false positives (tests passing when they shouldn’t be)
  • Write the minimum amount of code required to get the test passing (GREEN).
  • Refactor the code (REFACTOR). This might mean writing a more efficient technical solution or a more refined approach. As long as the test continues to stay green, you know there is no regression.