Jest console.warn react-i18next:: You will need pass in an i18next instance by using initReactI18next
console.warn
react-i18next:: You will need pass in an i18next instance by using initReactI18next
Solution
jest.mock('react-i18next', () => ({
// this mock makes sure any components using the translate hook can use it without a warning being shown
useTranslation: () => {
return {
t: (str) => str,
i18n: {
changeLanguage: () => new Promise(() => {}),
},
};
},
}));
Reference
https://react.i18next.com/misc/testing
Recent Comments