This repository contains code examples for the "Testing React Apps" section of the "Epic React" course, taught by Kent C. Dodds.
Link to the course: Epic React
"Testing React Apps" covers everything you need to test React components and applications with ease and get the knowledge you need to ship your applications with confidence. The topics cover are:
- Testing with ReactDom
- Testing with React Testing Library
- Avoiding Implementation Details
- Testing Forms
- Mocking HTTP Requests
- Mocking Browser APIs
- Mocking Modules
- Testing Context
- Testing Custom Hooks
- components: Contains the components used in the testing exercises.
- contexts: Contains the contexts used in the testing exercises.
- exercises: Contains the testing exercises.
- hooks: Contains the custom hooks used in the testing exercises.
- tests: Contains the tests - the solutions to the testing exercises.
- utils: Contains the utility functions used by the app and for testing.
- index.js: The entry point of the app.
- setupTests.js: Custom setup for testing.
- styles.css: The styles for the React app.
-
Clone the repository:
git clone https://github.com/RichardBacon/epic-react-testing.git
-
Install dependencies:
npm install
-
Start the React app:
npm start
-
Run the tests:
npm run test
- Node.js (version 18)
- npm (version 9)