Skip to content

Instantly share code, notes, and snippets.

@webNeat
Created February 27, 2019 17:52
Show Gist options
  • Save webNeat/c2ad9eedc2225aff01697be9e248df61 to your computer and use it in GitHub Desktop.
Save webNeat/c2ad9eedc2225aff01697be9e248df61 to your computer and use it in GitHub Desktop.
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