Testing React Applications
summary
Project adds tests to a React app using Jest, Enzyme and JSDOM and shows concrete patterns that work. Unit tests use shallow to assert a counter starts at 1 and that simulate('click') calls the onClick prop to make it 2. Full rendering uses mount to exercise lifecycle methods and verify componentDidMount spies run once; beware shared DOM and unmount between tests. Static output uses render/cheerio and Jest snapshots that fail on change and update with the U key.
AI-written summary · about
chapters (16)
- 0:00Introduction
- 0:25Why Testing
- 1:00Benefits of Testing
- 1:45What is React
- 3:29Shallow Mount
- 3:53Component Output
- 5:16Props
- 5:26Wrapper Props
- 6:28Mount
- 6:45Lifecycle Methods
- 7:30Render Render
- 8:02Snapshots
- 8:56Snapshot Limitations
- 9:20Snapshot Failure
- 9:32Update Snapshot
- 9:49Summary
related talks
53mTesting React Applications
06mJest & Enzyme-testing your React application
01h 00mTest Driving React Applications
30mTesting React Applications
41mUI and Unit Testing with Airbnb's Enzyme
16mCrushing React bugs with Jest and Enzyme
22mElizabeth Funk - An Introduction to React Testing Library
30mTesting Front-End Applications
