Start here. This is the direct spoken answer to practice first.
Why this question matters
A useful test suite must catch important regressions while remaining fast enough to run and clear enough to maintain. This question checks whether the candidate can choose test boundaries based on risk instead of putting every scenario into either tiny unit tests or expensive browser tests.
I choose tests according to the behavior and the cost of failure. Pure functions and complex transformations fit fast unit tests; components should be tested through visible behavior and user interactions; integration tests cover important boundaries such as routing, state, and API responses; and a small number of end-to-end tests protect critical journeys in a real browser. I avoid asserting internal state or implementation details because those tests break during harmless refactoring. The goal is confidence from the cheapest test that can realistically catch each failure.