Testing · Junior · Question 54 of 78
What is wrong with this test?
const { container } = render(<Counter />);
container.querySelector(".increment").click();
expect(container.querySelector(".value").textContent).toBe("1");- ✓Correct answer: It depends on CSS classes (implementation details); find elements by role and text and use user-event
- 2Nothing - it's the recommended style
- 3
containerdoesn't exist in RTL
Explanation
Renaming a class breaks the test although the user sees no change.