-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest-setup.ts
More file actions
47 lines (40 loc) · 1.27 KB
/
jest-setup.ts
File metadata and controls
47 lines (40 loc) · 1.27 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
44
45
46
47
import "@testing-library/react-native/extend-expect"
// import "react-native-gesture-handler/jestSetup"
import "@react-native-google-signin/google-signin/jest/build/jest/setup"
// import mockRNCNetInfo from "@react-native-community/netinfo/jest/netinfo-mock"
// import mockSafeAreaContext from "react-native-safe-area-context/jest/mock"
jest.mock("@react-native-async-storage/async-storage", () =>
require("@react-native-async-storage/async-storage/jest/async-storage-mock"),
)
// jest.mock("@react-native-community/netinfo", () => mockRNCNetInfo)
// jest.mock("react-native-safe-area-context", () => mockSafeAreaContext)
jest.mock("expo-router", () => {
const mockLink = jest.fn()
const mockScreen = jest.fn()
return {
Link: (props: Record<string, unknown>) => {
mockLink(props)
return props.children
},
Stack: {
Screen: (props: Record<string, unknown>) => {
mockScreen(props)
return props.children
},
},
mockLink,
mockScreen,
}
})
const consoleError = console.error
console.error = (message, ...args) => {
if (
typeof message === "string" &&
message.match(
/Warning: An update to .+ inside a test was not wrapped in act\(\.\.\.\)\./,
)
) {
return
}
return consoleError(message, ...args)
}