Course material for testing React components using react-testing-library
react-dom.js
- Render a React component for testingjest-dom.js
- Use jest-dom for improved assertionsdom-testing-library.js
- Use dom-testing-library to write more maintainable React testsreact-testing-library.js
- Use react-testing-library to render and test React Componentslocalized.js
- Testing localized content with react-testing-librarystate.js
- Test React Component state changes with react-testing-libraryprop-updates.js
- Test prop updates with react-testing-librarya11y.js
- Test accessibility of rendered React Components with jest-axedependency-injection.js
- Mock HTTP Requests with Dependency Injection in React Component Testshttp-jest-mock.js
- Mock HTTP Requests with jest.mock in React Component Testsmock-component.js
- Mock react-transition-group in React Component Tests with jest.mockerror-boundaries.js
- Test componentDidCatch handler error boundaries with react-testing-librarytdd-markup.js
- Test drive the development of a React Form with react-testing-librarytdd-functionality.js
- TDD the functionality of a React Form with react-testing-libraryreact-router.js
- Test react-router Provider history object in React Component Tests with createMemoryHistoryredux.js
- Test a redux connected React Componentcustom-hook.js
- Test a custom hookportals.js
- Test React portalsunmounting.js
- Test Unmounting a React Component with react-testing-libraryapp.js
- Testing the full application.
Note: the setup for this project uses kcd-scripts. Don't worry about that. You can learn about how to configure jest properly in the "Configure Jest for Testing JavaScript Applications" module of TestingJavaScript.com
- Intro to Test React Components with Jest and React Testing Library
- Render a React Component for Testing
react-dom.js
- Use Jest DOM for Improved Assertions
jest-dom.js
- Use DOM Testing Library to Write More Maintainable React Tests
dom-testing-library.js
- Use React Testing Library to Render and Test React Components
react-testing-library.js
- Debug the DOM State During Tests using React Testing Library’s debug Function
react-testing-library.js
- Test React Component Event Handlers with fireEvent from React Testing Library
state.js
- Improve Test Confidence with the User Event Module
state.js
- Test Prop Updates with React Testing Library
prop-updates-01.js
- Assert That Something is NOT Rendered with React Testing Library
prop-updates-02.js
- Test Accessibility of Rendered React Components with jest-axe
a11y.js
- Mock HTTP Requests with jest.mock in React Component Tests
http-jest-mock.js
- Mock HTTP Requests with Dependency Injection in React Component Tests
dependency-injection.js
- Mock react-transition-group in React Component Tests with jest.mock
mock-components.js
- Test componentDidCatch Handler Error Boundaries with React Testing Library
error-boundary-01.js
- Hide console.error Logs when Testing Error Boundaries with jest.spyOn
error-boundary-02.js
- Ensure Error Boundaries Can Successfully Recover from Errors
error-boundary-03.js
- Use React Testing Library’s Wrapper Option to Simplify using rerender
error-boundary-04.js
- Test Drive the Development of a React Form with React Testing Library
tdd-01-markup.js
- Test Drive the Submission of a React Form with React Testing Library
tdd-02-state.js
- Test Drive the API Call of a React Form with React Testing Library
tdd-03-api.js
- Test Drive Mocking react-router’s Redirect Component on a Form Submission
tdd-04-router-redirect.js
- Test Drive Assertions with Dates in React
tdd-05-dates.js
- Use Generated Data in Tests with tests-data-bot to Improve Test Maintainability
tdd-06-generate-data.js
- Test Drive Error State with React Testing Library
tdd-07-error-state.js
- Write a Custom Render Function to Share Code between Tests and Simplify Tests
tdd-08-custom-render.js
- Test React Components that Use the react-router Router Provider with createMemoryHistory
react-router-01.js
- Initialize the
history
Object with a Bad Entry to Test the react-router no-match Route
react-router-02.js
- Create a Custom render Function to Simplify Tests of react-router Components
react-router-03.js
- Test a Redux Connected React Component
redux-01.js
- Test a Redux Connected React Component with Initialized State
redux-02.js
- Create a Custom Render Function to Simplify Tests of Redux Components
redux-03.js
- Test a Custom React Hook with React’s Act Utility and a Test Component
custom-hook-01.js
- Write a Setup Function to Reduce Duplication of Testing Custom React Hooks
custom-hook-02.js
- Test a Custom React Hook with renderHook from React Hooks Testing Library
custom-hook-03.js
- Test Updates to Your Custom React Hook with rerender from React Hooks Testing Library
custom-hook-04.js
- Test React Portals with within from React Testing Library
portals.js
- Test Unmounting a React Component with React Testing Library
unmounting.js
- Write React Application Integration Tests with React Testing Library
app-01.js
- Improve Reliability of Integration Tests using find* Queries from React Testing Library
app-02.js
- Improve Reliability of Integration Tests Using the User Event Module
app-03.js