Skip to content

Instantly share code, notes, and snippets.

@CWSites
Created May 16, 2018 17:14
Show Gist options
  • Save CWSites/0c762ac1eb8211717798074c70ad7246 to your computer and use it in GitHub Desktop.
Save CWSites/0c762ac1eb8211717798074c70ad7246 to your computer and use it in GitHub Desktop.
react-i18next mock for using with Jest
import React, { Component } from 'react';
import * as reactI18next from 'react-i18next';
export const translate = () => Component => props => <Component t={() => ''} {...props} />;
export const I18n = reactI18next.I18n;
export const Interpolate = reactI18next.Interpolate;
export const Trans = reactI18next.Trans;
export const I18nextProvider = reactI18next.I18nextProvider;
export const loadNamespaces = reactI18next.loadNamespaces;
export const reactI18nextModule = reactI18next.reactI18nextModule;
export const setDefaults = reactI18next.setDefaults;
export const getDefaults = reactI18next.getDefaults;
export const setI18n = reactI18next.setI18n;
export const getI18n = reactI18next.getI18n;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment