-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetupTests.ts
47 lines (41 loc) · 949 Bytes
/
setupTests.ts
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
38
39
40
41
42
43
44
45
46
47
import '@testing-library/jest-dom/extend-expect';
window.HTMLElement.prototype.scrollIntoView = function () {};
jest.mock('react-i18next', () => ({
useTranslation: () => ({
t: (key: string) => key,
i18n: { changeLanguage: jest.fn() },
}),
Trans: () => null,
}));
jest.mock('next-i18next', () => ({
useTranslation: () => ({
t: (key: string) => key,
i18n: { changeLanguage: jest.fn() },
}),
Trans: () => null,
}));
jest.mock('next/router', () => ({
useRouter: () => ({
push: jest.fn(),
pathname: '/',
route: '/',
asPath: '/',
query: '',
}),
}));
jest.mock('next/config', () => () => ({
serverRuntimeConfig: {},
publicRuntimeConfig: {},
}));
jest.mock('axios', () => {
return {
create: () => {
return {
interceptors: {
request: { eject: jest.fn(), use: jest.fn() },
response: { eject: jest.fn(), use: jest.fn() },
},
};
},
};
});