Testing React Components
Write tests that survive refactors: query the way users do, simulate real interaction, handle async updates, and know what is worth mocking.
- Level
- Advanced
- Chapters
- 4
- Exercises
- 1
- Reading time
- 16 min
What you will cover
- 1. What to TestThe guiding principle behind React Testing Library, and what not to bother with.
- 2. QueriesFinding elements the way a user would, in priority order.
- 3. Interactions and AsyncSimulating real user behaviour and waiting for the result.
- 4. Mocking and SetupFaking the network, testing hooks, and a checklist for good tests.