jargon

Comparison

Component testvsUnit test

Component test

you rendered the component, clicked the button as a user would, and asserted on what appeared.

A test that renders a component with its real children and asserts on the rendered output and behaviour rather than on internals. It is the highest-value shape in frontend testing, because it catches the wiring mistakes that unit tests structurally cannot while still running fast. It stays useful across refactors only if it queries by role and text, the way a user finds things.

Full entry →

Unit test

you tested one function's output for a given input, with nothing else running around it.

A test of a single piece of logic in isolation, with its collaborators replaced or absent. It runs in milliseconds and points directly at the broken line, which is why it is the right shape for pure logic — formatting, parsing, reducers, calculations. In a user interface most bugs are not in one function, which is why a suite made only of these can be green while the page is broken.

Full entry →

Related comparisons