generated from willtp87/panting-react-native-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.setup.ts
31 lines (27 loc) · 899 Bytes
/
jest.setup.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
// Make toBeInTheDocument() available globally.
import "@testing-library/jest-dom";
// https://github.com/expo/expo/issues/27496
jest.mock("expo-localization", () => ({
...jest.requireActual("expo-localization"),
getLocales: jest.fn(() => {
return [{ languageCode: "en" }];
}),
}));
// Mock useNavigation hook. So that we can test components that use it.
jest.mock("expo-router", () => ({
...jest.requireActual("expo-router"),
useNavigation: jest.fn(() => {
return { setOptions: jest.fn() };
}),
}));
// Mock AsyncStorage.
jest.mock("@react-native-async-storage/async-storage", () =>
require("@react-native-async-storage/async-storage/jest/async-storage-mock"),
);
// https://github.com/expo/expo/issues/25494
jest.mock("react-native-reanimated", () => null, {
virtual: true,
});
jest.mock("@testing-library/jest-native/extend-expect", () => null, {
virtual: true,
});