Module 10 of 14

Testing

Lessons

About This Module

Testing gives you confidence that your code actually works, and keeps working as you change it. This module starts with fast, focused unit tests, moves into testing React components the way a user would interact with them, and finishes with end-to-end tests that check a whole flow in a real browser.

Good tests catch regressions before your users do. Work through these lessons in order, then move on to Accessibility to make sure your app works for everyone.

Lessons

7 videos · 1 article
01

Why Test Your Code?

What automated tests catch that manual clicking around doesn't, and the different types of tests you'll write.

02

Unit Testing Basics

Writing your first tests with a runner like Jest or Vitest, and structuring a test file.

03

Testing Pure Functions & Assertions

Writing clear assertions, and why functions without side effects are the easiest place to start testing.

04

Mocking & Test Doubles

Faking network calls, timers, and modules so your tests stay fast and predictable.

05

Testing React Components

Rendering components in a test environment and asserting on what the user would actually see.

06

Integration Testing

Testing how multiple pieces work together, sitting between fast unit tests and slower end-to-end tests.

07

End-to-End Testing

Automating a full user flow in a real browser with tools like Cypress or Playwright.