Search⌘ K
AI Features

Writing a Component Test with React Testing Library

Explore how to write effective component tests using React Testing Library. Learn to render components, select elements with queries, and refactor tests for simplicity and resilience without depending on implementation details.

Refactoring the component test

The starter project for this lesson is the project we finished in the last lesson. It contains a test on an ErrorMessage component that verifies that the value of the message prop is rendered correctly.

The starter project was ...