1
1
import React from 'react' ;
2
2
import configureStore from 'redux-mock-store' ;
3
3
import thunk from 'redux-thunk' ;
4
- import { useTranslation } from 'react-i18next' ;
5
4
import { setupServer } from 'msw/node' ;
6
5
import { rest } from 'msw' ;
7
6
import { act } from 'react-dom/test-utils' ;
8
7
import SketchList from './SketchList' ;
9
8
import { reduxRender , fireEvent , screen , within } from '../../../test-utils' ;
10
9
import { initialTestState } from '../../../testData/testReduxStore' ;
11
10
11
+ jest . mock ( 'react-i18next' , ( ) => ( {
12
+ useTranslation : ( ) => ( {
13
+ t : ( key ) => key ,
14
+ i18n : {
15
+ changeLanguage : jest . fn ( ) ,
16
+ language : 'en-US'
17
+ }
18
+ } ) ,
19
+ initReactI18next : {
20
+ type : '3rdParty' ,
21
+ init : jest . fn ( )
22
+ }
23
+ } ) ) ;
24
+
12
25
jest . mock ( '../../../i18n' ) ;
13
26
14
27
const server = setupServer (
@@ -27,9 +40,8 @@ afterAll(() => server.close());
27
40
describe ( '<Sketchlist />' , ( ) => {
28
41
const mockStore = configureStore ( [ thunk ] ) ;
29
42
const store = mockStore ( initialTestState ) ;
30
- const { t } = useTranslation ( ) ;
31
43
32
- let subjectProps = { username : initialTestState . user . username , t } ;
44
+ let subjectProps = { username : initialTestState . user . username } ;
33
45
34
46
const subject = ( ) =>
35
47
reduxRender ( < SketchList { ...subjectProps } /> , { store } ) ;
0 commit comments