Test That Element Does Not Render In The Component
With react-testing-library
, you can render a component and make assertions about the different parts of the component that get rendered.
You can also make assertions that certain things don't get rendered. To do that, first render the component:
Then add a not
expectation with a query*
-style matcher:
You'll get an immediate test failure if you try to directly select for the element using a get*
-style matcher:
Last updated