34
React Testing

React Testing

Testing from the user's perspective with Testing Library and userEvent. Eight lessons covering queries, async UI, mocking, custom hooks, and the honest state of Server Component testing in 2026.

~ 110 min·8 lessons·updated apr 2026

What you'll learn


Lessons

Read in order. Each lesson stands on its own, but the order is deliberate.

8 lessons · ~110 min total

  1. 01
    Why test from the outside
    Testing Library's doctrine. Test what the user sees, not what the component owns.
    13 min
  2. 02
    render and queries
    getByRole, getByLabelText, the priority order. Why getByTestId is the last resort.
    16 min
  3. 03
    userEvent vs fireEvent
    Clicks, typing, tabbing. Why userEvent simulates a real user and fireEvent does not.
    14 min
  4. 04
    Async UI
    findBy, waitFor, and the rules for testing things that arrive over time.
    15 min
  5. 05
    Mocking
    Mock the network, sometimes the module. Don't mock your own components or hooks.
    14 min
  6. 06
    Testing custom hooks
    renderHook for hooks without UI. When a hook test beats a component test, and when it loses.
    13 min
  7. 07
    Testing Server Components, today
    What works for RSC tests in 2026, what doesn't, and where the seams actually are.
    13 min
  8. 08
    Test smells and recovery
    Flaky waitFor, overspecified assertions, snapshots that nobody reads. How to undo each one.
    12 min

Prerequisites

  • · Finished React Performance
  • · Comfortable writing components and hooks
  • · Have run a test command from a terminal

After this, try