-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.setup.js
More file actions
37 lines (36 loc) · 993 Bytes
/
jest.setup.js
File metadata and controls
37 lines (36 loc) · 993 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
jest.mock('redux-persist', () => {
const actualReduxPersist = jest.requireActual('redux-persist');
return {
...actualReduxPersist,
persistReducer: jest.fn((_, reducer) => reducer),
persistStore: jest.fn().mockImplementation(() => ({
subscribe: jest.fn(),
getState: jest.fn().mockReturnValue({ bootstrapped: true }),
purge: jest.fn().mockResolvedValue(null),
flush: jest.fn().mockResolvedValue(null),
pause: jest.fn(),
persist: jest.fn(),
dispatch: jest.fn(),
})),
createMigrate: jest.fn(() => jest.fn()),
createTransform: jest.fn((inbound, outbound) => ({
in: inbound || (data => data),
out: outbound || (data => data),
})),
};
});
jest.mock('react-i18next', () => ({
useTranslation: () => {
return {
t: i18nKey => i18nKey,
i18n: {
changeLanguage: jest.fn(),
language: 'en',
},
};
},
initReactI18next: {
type: '3rdParty',
init: () => {},
},
}));