Created
February 27, 2019 17:52
-
-
Save webNeat/c2ad9eedc2225aff01697be9e248df61 to your computer and use it in GitHub Desktop.
This file contains hidden or 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, flushEffects} from 'react-testing-library' | |
export const testHook = hook => (...args) => { | |
let data = null | |
const Component = () => { | |
data = hook(...args) | |
return null | |
} | |
render(<Component />) | |
return () => { | |
flushEffects() | |
return data | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment