How to test unmounting of functional components when using useEffect for componentWillMount?

I have a functional component where I used useEffect to achieve similar functionality of componentWillUnmount. How to test that using Jest?

My Component:

const myComp = () => {
  useEffect(() => () => {
  }, []);
  return <div>Test</div>;

Read more here:

Content Attribution

This content was originally published by Paveloosha at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: