-
Notifications
You must be signed in to change notification settings - Fork 0
/
setupTests.js
28 lines (24 loc) · 1.01 KB
/
setupTests.js
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
// https://reactnavigation.org/docs/testing/
import 'react-native-gesture-handler/jestSetup'
// This mock will prevent the test accessing async storage which is not available in the test environment
// https://react-native-async-storage.github.io/async-storage/docs/advanced/jest
jest.mock('@react-native-async-storage/async-storage', () =>
require('@react-native-async-storage/async-storage/jest/async-storage-mock')
)
// This mock will prevent the test accessing the real firebase database
jest.mock('firebase/auth/react-native', () => ({
...jest.requireActual('firebase/auth/react-native'),
...['getReactNativePersistence', 'initializeAuth'].reduce(
(preview, elem) => ({ ...preview, [elem]: jest.fn(b => b) }),
{}
),
}))
jest.mock('@react-navigation/native', () => {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { useEffect } = require('react')
const actualModule = jest.requireActual('@react-navigation/native')
return {
...actualModule,
useFocusEffect: useEffect,
}
})