From 280412e2db5e697261b841691f4263bb654d8dfc Mon Sep 17 00:00:00 2001 From: Jeff Avallone Date: Tue, 26 Mar 2019 18:26:20 -0400 Subject: [PATCH] Mocking the useTranslation hook --- src/__mocks__/react-i18next.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/__mocks__/react-i18next.js b/src/__mocks__/react-i18next.js index 14d998c..8a297ab 100644 --- a/src/__mocks__/react-i18next.js +++ b/src/__mocks__/react-i18next.js @@ -1,6 +1,8 @@ const reactI18next = jest.requireActual('react-i18next'); +const i18n = require('i18n'); module.exports = { ...reactI18next, - Trans: require('__mocks__/component-mock').buildMock(reactI18next.Trans) + Trans: require('__mocks__/component-mock').buildMock(reactI18next.Trans), + useTranslation: () => ({ i18n, t: i18n.mockT }) };