I have a React component which, when given badly configured props, returns null
screen.debug()
in Vitest displays the result like this:
<body>
<div />
</body>
This is expected, but what constitutes a good test for this markup?
Currently I’m testing the absence of tags that would be present if the component returned a JSX element. Does that sound right?
you can use the
shallowMount
method to mount the component and then use theexists
method to check if the component exists.import { shallowMount } from '@vue/test-utils';