
Testing matters across languages and frameworks, reducing bugs as code evolves. The video notes that tests are not a silver bullet and should not start a project.
Access the course source code in the description box below for every video where code appears, so you can review the implementation.
Set up a React project with Vite, install Node.js, and configure npm to run a dev server, preparing for unit and end-to-end testing.
Recommend using VS Code for JavaScript and TypeScript with built-in syntax highlighting, and install prettier to format on save for JavaScript, TypeScript, HTML, and CSS.
Define unit testing as validating small chunks of code, such as functions or React components, in isolation to ensure each feature works correctly and to cover all cases with tests.
Set up a vitest testing environment for React with React Testing Library and jsdom. Install dev dependencies, configure vitest, and write a basic describe/it test.
Test simple functions and helpers by organizing unit tests with nested describes for the range function, importing from utils.js, and validating results with expect.
Learn to test a simple react component using the react testing library by rendering with props, locating elements by data test id, and asserting text content for default messages.
Test a pagination component's rendering and click behavior with React Testing Library, covering total, limit, current page, and select page, plus user-event interactions and call assertions.
Explore the differences between mock and spy in unit tests, using a pagination example with a range function to isolate external dependencies and verify behavior rather than internal values.
Explore testing a useState-based username component with React Testing Library, focusing on rendering default empty text, updating state via button click and input typing, and avoiding state mocking.
Test useEffect and API calls in React by fetching tags with Axios, rendering via a test id, and validating with Testing Library; compare MSW server mocks with Axios spies.
Test a simple custom hook with renderHook from the Testing Library, verify initial count, initialize with a value, and validate increment behavior using act.
Explains testing a complex custom hook Usefetch that fetches data with axios from a url and returns loading, error, and response, including mocking axios and renderHook with async act.
Learn to test a real React project's context provider, reducers, and API calls with mocks, using React Testing Library for add, update, and remove todo actions.
Test the header component within a todos context by wrapping it with a provider, simulate typing and pressing enter to trigger add todo, and verify the function is called.
Learn how to test a React footer component using a todos context, validating visibility with and without todos, counting items left, and ensuring filter links update the active filter.
learn to implement a custom render in react testing to wrap components with multiple providers like redux, react query, and theme provider, and reuse test utilities for cleaner tests.
Explore unit testing a real React to-do component, covering rendering with the provider, mocking update and remove callbacks, toggling completion, editing, and focusing the edit input.
Test the main component by rendering with a todos context, mocking child components to simulate isolation, and verify props, toggle all behavior, and visibility with and without todos.
Learn how to test setTimeout in React using fake timers, advance timers by time, and wrap state updates in act for fast, reliable unit tests.
Explore testing Redux reducers in a React app using Redux toolkit, focusing on state with isLoading, error, and data, synchronous actions like set error, and async thunks: pending and fulfilled.
Learn to test Redux-connected React components by wrapping with a provider and a configured store, mocking Axios fetch calls, and validating post data and errors.
Explore end-to-end testing concepts, including intent testing on a real website, and compare its pros and cons with unit testing to improve overall website stability.
End-to-end test a todo app with Cypress, including setup, base URL, API interception, and verifying rendering, filtering, adding, editing, and deleting todos.
Celebrate completing the react testing course and mastering unit and e2e testing. Apply what you learned by testing your own project thoroughly and fixing mistakes for continued growth.
This course is great preparation for any React testing that you may have coming up. Quality code testing needs a lot amount of knowledge, but the best way to prepare for it is a lot of practice! In this course you will everything that come from real React projects about testing. There are no excersises that nobody asks here. In every video you will learn something useful that you will write every day. We will take a deep dive into the skills, concepts, and techniques that are required to solve each problem.
When you have completed this course you will have mastered React testing on a high level and you will also have learned the concepts, skills, and techniques, like testing with Vitest and Cypress and using things like mocking and spying that are necessary for you to excel in any testing. You will feel very confident testing any React project you will have. On top of all this, you will strengthen your React programming skills and React fundamentals in overall.
Core topics of the course:
Unit testing concepts
E2E concepts
Testing context and hooks
Mocking and spying dependencies
Testing components
Testing Redux
Full project unit testing on a real project
Cypress testing on a real project