11import React from 'react' ;
22import configureStore from 'redux-mock-store' ;
33import thunk from 'redux-thunk' ;
4- import { useTranslation } from 'react-i18next' ;
54import { setupServer } from 'msw/node' ;
65import { rest } from 'msw' ;
76import { act } from 'react-dom/test-utils' ;
87import SketchList from './SketchList' ;
98import { reduxRender , fireEvent , screen , within } from '../../../test-utils' ;
109import { initialTestState } from '../../../testData/testReduxStore' ;
1110
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+
1225jest . mock ( '../../../i18n' ) ;
1326
1427const server = setupServer (
@@ -27,9 +40,8 @@ afterAll(() => server.close());
2740describe ( '<Sketchlist />' , ( ) => {
2841 const mockStore = configureStore ( [ thunk ] ) ;
2942 const store = mockStore ( initialTestState ) ;
30- const { t } = useTranslation ( ) ;
3143
32- let subjectProps = { username : initialTestState . user . username , t } ;
44+ let subjectProps = { username : initialTestState . user . username } ;
3345
3446 const subject = ( ) =>
3547 reduxRender ( < SketchList { ...subjectProps } /> , { store } ) ;
0 commit comments