How do I check if a component is not present, i.e. that a specific component has not been rendered?
Providing a slightly updated answer based on the documentation for enzyme-matchers's toExist. This will require you to install the enzyme-matchers
package.
function Fixture() {
return (
);
}
const wrapper = mount( ); // mount/render/shallow when applicable
expect(wrapper.find('span')).toExist();
expect(wrapper.find('ul')).not.toExist();