0
Challenge · 87Tooling & Quality

Integration Testing

Testingused in ~40% of apps

A passing pile of unit tests can still ship a broken feature: each part works alone, but the form never actually fills the list. Integration tests render the real components together and exercise the whole flow — type, submit, see the result — so you test what the user does, not what the parts do.

Core idea. An integration test mounts several components as one feature, drives a real user flow with userEvent, mocks only the network boundary (with MSW), and asserts the user-visible outcome — giving you the most confidence per line of test code.
Playground, this isn't a screenshot
integration test — one flow, many components, network mocked
<Feed /> — the feature under test
#1First post on Pulse

Try it by hand: type, press Post. The test below drives this exact flow — no internals poked.

test runner — Vitest + Testing Library
Mount the whole feature
User types a post
User clicks Post
MSW intercepts the network call
Assert the list updated
the testing trophy — write tests, not too many, mostly integration
E2Efew · slow · most confidence
Integrationthe sweet spot — best ROI
Unitmany · fast · low confidence
Static (types + lint)free — TypeScript / ESLint

Integration tests render several components together and mock only the network — the best confidence-per-effort, so favor them.

↑ play a little first, then dig in