I have a component library that I’m writing unit tests for using Jest and react-testing-library. Based on certain props or events I want to verify that certain elements aren’t being rendered.
getByText
, getByTestId
, etc throw and error in react-testing-library
if the element isn’t found causing the test to fail before the expect
function fires.
How do you test for something not existing in jest using react-testing-library?