-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathjest-setup.js
More file actions
36 lines (32 loc) · 1019 Bytes
/
jest-setup.js
File metadata and controls
36 lines (32 loc) · 1019 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
27
28
29
30
31
32
33
34
35
36
// Needed for tests to run, fails otherwise
jest.mock("react-native/Libraries/EventEmitter/NativeEventEmitter");
jest.mock("react-native-webview", () => ({
default: () => jest.fn(), // or any mocked component instead of native view,
}));
jest.mock("expo-constants", () => {
const actual = jest.requireActual("expo-constants");
return { ...actual, experienceUrl: null };
});
jest.mock("expo-asset", () => {
const actual = jest.requireActual("expo-asset");
class Asset extends actual.Asset {
static fromModule() {
return new actual.Asset({ name: "Name", type: "type", uri: "uri" });
}
}
return { ...actual, Asset, getManifestBaseUrl: () => "" };
});
jest.mock("expo-av", () => {
return {
Audio: {
setAudioModeAsync: jest.fn(),
},
Sound: {
onPlaybackStatusUpdate: jest.fn(),
createAsync: jest.fn(),
},
};
});
jest.mock("@react-native-async-storage/async-storage", () =>
require("@react-native-async-storage/async-storage/jest/async-storage-mock")
);