Series: Testing React
All the articles within the series "Testing React".
How to test React apps with Vitest and Vite
Updated: at 12:00 PMSet up Vitest and React Testing Library on Vite. Put the test block in vite.config.ts and load @testing-library/jest-dom/vitest. The button says Count is 0.
How To Use rerender in React Testing Library
Updated: at 12:00 PMrerender updates props on the component already mounted. A second render() adds a copy, so the label query matches twice.
Understanding Jest Snapshots: A Beginner's Guide to Snapshot Testing
Updated: at 05:14 AMGet started with Jest Snapshots: beginner's guide to snapshot testing, usage, updates, and other React component testing techniques
How to test a className with Jest and React testing library
Updated: at 08:20 PMReact Testing Library has no getByClassName. Query by role or text, assert the class with toHaveClass, and use querySelector only when you need a class name.
Test complex DOM structures with React Testing Library
Updated: at 06:24 AMOptimize DOM Testing using React Testing Library for enhanced accuracy, maintainability, and precise UI targeting with specific queries and options
How to Test Props in React with Jest
Updated: at 04:16 PMMock a child React component with Jest, render its props as text, and assert that the parent passed the props you expect.