How can I test using jest/react-testing-library that a component is returning specific JSX?
I have toBeInstanceOf, etc, but it is hard to find information about "react-testing-library"
these are a few examples
const className = props.className;
if (!props.action) {
return props.children;
}
const { id, type, target } = props.action;
if (type === "EXTERNAL") {
return (
<a className={className} href={target}>
{props.children}
</a>
);
}
if (["page"].includes(type.toLowerCase())) {
return (
<Link className={className} key={id} to={"/" + target}>
{props.children}
</Link>
);
}
if (type.toLowerCase() === "play") {
return props.children;
} ...
as you can see every return is different jsx.