How do you test for the non-existence of an element using jest and react-testing-library?
From DOM Testing-library Docs – Appearance and Disappearance Asserting elements are not present The standard getBy methods throw an error when they can’t find an element, so if you want to make an assertion that an element is not present in the DOM, you can use queryBy APIs instead: const submitButton = screen.queryByText(‘submit’) expect(submitButton).toBeNull() // … Read more