I use React testing library for my unit test.
I want to test this of my React component:
return (
<div>
<p data-testid="my-string">
{string}
</p>
</div>
);
After I query queryByTestId the component I receive something like:
<p class="css-1317scs-myString" data-testid="my-string"><iframe src="src="https://my-site.com?id=6533cf73&autoplay=false" allowfullscreen seamless frameborder="0" allow="encrypted-media"></iframe></p>
So with all the html tags etc.
expect(queryByTestId('my-string')).toBe(
'<iframe src="https://my-site.com?id=6533cf73&autoplay=false" allowfullscreen seamless frameborder="0" allow="encrypted-media"></iframe>'
);
I just want to test if <iframe src="https://my-site.com?id=6533cf73&autoplay=false" allowfullscreen seamless frameborder="0" allow="encrypted-media"></iframe> is exactly defined like this.
How do I get rid of all those html tags. Or do I have to use another approach?