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?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…