-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathjest.setup.js
More file actions
43 lines (36 loc) · 1.1 KB
/
jest.setup.js
File metadata and controls
43 lines (36 loc) · 1.1 KB
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
// jest.setup.js
import "@testing-library/jest-native/extend-expect";
import mockAsyncStorage from "@react-native-async-storage/async-storage/jest/async-storage-mock";
jest.mock("@react-native-async-storage/async-storage", () => mockAsyncStorage);
jest.mock("@firebase/auth", () => {
const mockOnAuthStateChanged = jest.fn();
const mockSignOut = jest.fn();
const mockSignInWithEmailAndPassword = jest.fn();
return {
getAuth: () => ({
onAuthStateChanged: mockOnAuthStateChanged,
signOut: mockSignOut,
signInWithEmailAndPassword: mockSignInWithEmailAndPassword,
}),
};
});
jest.mock(
"react-native/Libraries/Components/StatusBar/StatusBar",
() => "StatusBar"
);
// Mock Platform
jest.mock("react-native/Libraries/Utilities/Platform", () => ({
OS: "ios",
select: jest.fn((obj) => obj.ios),
}));
const originalError = console.error;
console.error = (...args) => {
if (
args[0].includes("Warning: An update to Animated") ||
args[0].includes("Error initializing auth:") ||
args[0].includes("act(...)")
) {
return;
}
originalError.call(console, ...args);
};