Skip to content

Instantly share code, notes, and snippets.

@kykean
Created June 9, 2017 09:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kykean/952179fee07ec6aef14449c880c03b55 to your computer and use it in GitHub Desktop.
Save kykean/952179fee07ec6aef14449c880c03b55 to your computer and use it in GitHub Desktop.
jest manual mock to replace react-i18next, so tests can use mount with stubs covering lifecycle methods.
// place in __mocks__/react-i18next.js , same directory level with node_modules
const i18next = jest.genMockFromModule('react-i18next');
i18next.t = (i) => i;
i18next.translate = (c) => (k) => k;
module.exports = i18next;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment