-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathjest.setup.js
49 lines (43 loc) · 1.53 KB
/
jest.setup.js
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
48
49
require("reflect-metadata");
import mockAsyncStorage from "@react-native-async-storage/async-storage/jest/async-storage-mock";
import SafeAreaContextMock from "react-native-safe-area-context/jest/mock";
import mockRNCNetInfo from "@react-native-community/netinfo/jest/netinfo-mock.js";
jest.useFakeTimers();
jest.mock("reactotron-react-native", () =>
require("./__mocks__/reactotron/reactotron"),
);
jest.mock("react-native/Libraries/EventEmitter/NativeEventEmitter");
jest.mock("@react-native-async-storage/async-storage", () => mockAsyncStorage);
jest.mock("@react-navigation/native", () => {
const actualNav = jest.requireActual("@react-navigation/native");
return {
...actualNav,
useNavigation: () => ({
navigate: jest.fn(),
dispatch: jest.fn(),
}),
};
});
jest.mock("@react-native-community/netinfo", () => mockRNCNetInfo);
jest.mock("@react-native-community/datetimepicker", () => jest.fn());
jest.mock("react-native/Libraries/Animated/NativeAnimatedHelper");
jest.mock("react-i18next", () => ({
initReactI18next: { type: "3rdParty", init: jest.fn() },
useTranslation: () => {
return {
t: (str) => str,
i18n: {
changeLanguage: () => new Promise(() => {}),
},
};
},
}));
jest.mock("@tarikfp/react-native-utils", () => {
return {
useGoBackHandler: jest.fn(() => true),
getDeviceNativeLanguage: jest.fn(() => "en"),
getWindowWidth: jest.fn(() => 100),
getWindowHeight: jest.fn(() => 100),
};
});
jest.mock("react-native-safe-area-context", () => SafeAreaContextMock);