Skip to content

Commit 9ed5799

Browse files
committed
fix test error
1 parent a466640 commit 9ed5799

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

client/modules/IDE/components/SketchList.unit.test.jsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,27 @@
11
import React from 'react';
22
import configureStore from 'redux-mock-store';
33
import thunk from 'redux-thunk';
4-
import { useTranslation } from 'react-i18next';
54
import { setupServer } from 'msw/node';
65
import { rest } from 'msw';
76
import { act } from 'react-dom/test-utils';
87
import SketchList from './SketchList';
98
import { reduxRender, fireEvent, screen, within } from '../../../test-utils';
109
import { 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+
1225
jest.mock('../../../i18n');
1326

1427
const server = setupServer(
@@ -27,9 +40,8 @@ afterAll(() => server.close());
2740
describe('<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

Comments
 (0)