Skip to content

Commit

Permalink
Merge bda352b into da6a986
Browse files Browse the repository at this point in the history
  • Loading branch information
chownces authored May 3, 2024
2 parents da6a986 + bda352b commit 88d4e79
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 25 deletions.
5 changes: 5 additions & 0 deletions craco.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,11 @@ const cracoConfig = {
'<rootDir>/node_modules/vfile/lib';
jestConfig.moduleNameMapper['vfile/do-not-use-conditional-minurl'] =
'<rootDir>/node_modules/vfile/lib';

jestConfig.setupFiles = [
...jestConfig.setupFiles,
'./src/i18n/i18n.ts' // Setup i18next configuration
]
return jestConfig;
}
},
Expand Down
4 changes: 3 additions & 1 deletion src/i18n/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ import { initReactI18next } from 'react-i18next';

import { i18nLanguageCode, resources } from './locales';

const isDevelopment = process.env.NODE_ENV === 'development';

i18n
.use(LanguageDetector)
.use(initReactI18next)
.init({
fallbackLng: i18nLanguageCode.ENGLISH,
debug: true,
debug: isDevelopment,
resources,
interpolation: {
escapeValue: false // not needed for react as it escapes by default
Expand Down
17 changes: 0 additions & 17 deletions src/i18n/i18nForTests.ts

This file was deleted.

10 changes: 3 additions & 7 deletions src/pages/login/__tests__/Login.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { render } from '@testing-library/react';
import { I18nextProvider } from 'react-i18next';
import { Provider, useDispatch } from 'react-redux';
import * as ReactRouter from 'react-router';
import { StaticRouter } from 'react-router-dom/server';
import { fetchAuth } from 'src/commons/application/actions/SessionActions';
import i18n from 'src/i18n/i18nForTests';

import { mockInitialStore } from '../../../commons/mocks/StoreMocks';
import Login from '../Login';
Expand Down Expand Up @@ -37,11 +35,9 @@ describe('Login', () => {
const store = mockInitialStore();
const app = (
<Provider store={store}>
<I18nextProvider i18n={i18n}>
<StaticRouter location="/login">
<Login />
</StaticRouter>
</I18nextProvider>
<StaticRouter location="/login">
<Login />
</StaticRouter>
</Provider>
);
const tree = render(app);
Expand Down

0 comments on commit 88d4e79

Please sign in to comment.