Skip to content

Passing i18next instance i Remix stub? #218

Closed Answered by stonetwig
stonetwig asked this question in Q&A
Discussion options

You must be logged in to vote

Solved it by mocking it in setup-test-env.ts

vi.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: string) => str,
      i18n: {
        changeLanguage: () => new Promise(() => {}),
      },
    };
  },
  initReactI18next: {
    type: '3rdParty',
    init: () => {},
  },
}));

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by stonetwig
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants