Tag: Jest
All the articles with the tag "Jest".
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.
How to test props in React Testing Library
Updated: at 12:00 PMMock the child with jest.mock and read the prop from the text. On Jest 30 the mock variable's name has to start with mock.
How to migrate from Mocha to Jest
Updated: at 02:46 PMMove a Mocha suite to Jest with small edits instead of rewriting tests, including JSDOM via Jest's testEnvironment and mocha.opts.