-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathjest.setup.ts
More file actions
26 lines (22 loc) · 778 Bytes
/
jest.setup.ts
File metadata and controls
26 lines (22 loc) · 778 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
// Make toBeInTheDocument() available globally.
import "@testing-library/jest-dom";
// https://github.com/callstack/react-native-paper/issues/4561
jest.mock("expo-font");
// 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"),
);