Last active
January 24, 2020 07:05
-
-
Save sketchbuch/861862858cb7528dfa044b4a4a9dbe13 to your computer and use it in GitHub Desktop.
TESTING - Jest mock translate for jest / react-i18next with components
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 { translate } from 'react-i18next' | |
jest.mock('react-i18next', () => ({ | |
t: (key: string) => key, | |
translate: () => Component => { | |
Component.defaultProps = { ...Component.defaultProps, t: () => '' } | |
return Component | |
}, | |
})) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment