Created
March 31, 2020 15:25
-
-
Save nathansmith/b486e7d841df3abd0d9801a0978a2b8f to your computer and use it in GitHub Desktop.
Forces `useEffect` to be called in Jest tests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { render } from 'react-dom'; | |
// Helper. | |
const callUseEffect = () => { | |
const Noop = () => null; | |
const root = document.createElement('div'); | |
render(<Noop />, root); | |
}; | |
// Export. | |
export { callUseEffect }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment