UI and Unit Testing with Airbnb's Enzyme
summary
Demonstrates testing React with Enzyme and Jest using shallow rendering to simulate events, spies for callbacks, and state inspection; breaks a submit spec into three focused tests instead of one bulky test; uses enzyme-to-json and snapshots reduce tests 40–60% by replacing many DOM assertions; notes that mount requires jsdom for full child rendering and that Jest runs about 700 tests in ~1 minute; mentions a small Jest dashboard utility being developed and explains how failing snapshots update with a single keystroke.
AI-written summary · about
chapters (13)
- 0:00Introduction
- 1:28Why unit testing matters
- 4:22Why use Enzyme
- 6:06Testing React components
- 10:27Testing user interactions
- 12:39Stateful components testing
- 15:28Avoiding overloaded tests
- 18:41UI testing with snapshots
- 22:36Snapshot benefits
- 24:46Setting up dependencies
- 27:35Jest configuration
- 29:42Testing strategy summary
- 31:51Q&A session
related talks
16mCrushing React bugs with Jest and Enzyme
06mJest & Enzyme-testing your React application
32mEnzyme/Jest React Components Testing by Hayk Barseghyan (Arm) | JSConfAM19
18mTesting React in a Right Way
22mElizabeth Funk - An Introduction to React Testing Library
10mTesting React Applications
01h 02mWriting better tests for your JavaScript app
14mSnapshot testing
