-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathjest.setup.ts
87 lines (81 loc) · 2.32 KB
/
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
// @ts-ignore
import mockRNDeviceInfo from "react-native-device-info/jest/react-native-device-info-mock";
// todo(lustig): figure out how to use dotenv in jest - this was working before I left
// require("dotenv").config();
jest.mock("react-native-webview", () => {
const { View } = require("react-native");
return {
WebView: () => View,
};
});
jest.mock("react-native-device-info", () => mockRNDeviceInfo);
jest.mock("react-native/Libraries/EventEmitter/NativeEventEmitter");
jest.mock("react-native-fs", () => {
return {
mkdir: jest.fn(),
moveFile: jest.fn(),
copyFile: jest.fn(),
pathForBundle: jest.fn(),
pathForGroup: jest.fn(),
getFSInfo: jest.fn(),
getAllExternalFilesDirs: jest.fn(),
unlink: jest.fn(),
exists: jest.fn(),
stopDownload: jest.fn(),
resumeDownload: jest.fn(),
isResumable: jest.fn(),
stopUpload: jest.fn(),
completeHandlerIOS: jest.fn(),
readDir: jest.fn(),
readDirAssets: jest.fn(),
existsAssets: jest.fn(),
readdir: jest.fn(),
setReadable: jest.fn(),
stat: jest.fn(),
readFile: jest.fn(),
read: jest.fn(),
readFileAssets: jest.fn(),
hash: jest.fn(),
copyFileAssets: jest.fn(),
copyFileAssetsIOS: jest.fn(),
copyAssetsVideoIOS: jest.fn(),
writeFile: jest.fn(),
appendFile: jest.fn(),
write: jest.fn(),
downloadFile: jest.fn(),
uploadFiles: jest.fn(),
touch: jest.fn(),
MainBundlePath: jest.fn(),
CachesDirectoryPath: jest.fn(),
DocumentDirectoryPath: "",
ExternalDirectoryPath: jest.fn(),
ExternalStorageDirectoryPath: jest.fn(),
TemporaryDirectoryPath: "",
LibraryDirectoryPath: jest.fn(),
PicturesDirectoryPath: jest.fn(),
};
});
jest.mock("./utils/evm/privy", () => ({
getPrivyRequestHeaders: jest.fn(),
}));
jest.mock("rn-fetch-blob", () => {
return {
DocumentDir: () => {},
polyfill: () => {},
};
});
jest.mock("@sentry/react-native", () => ({
init: jest.fn(),
addBreadcrumb: jest.fn(),
}));
jest.mock("expo-constants", () => ({}));
jest.mock("uuid", () => ({
v4: jest.fn(() => "uuidv4"),
}));
jest.mock("path", () => ({
join: jest.fn(() => ""),
}));
jest.mock("expo-localization", () => ({
// TODO: Update later to begin returning more locales and mock within individual tests
getLocales: jest.fn(() => [{ languageTag: "en-US" }]),
}));