fix test stubs
This commit is contained in:
+22
-13
@@ -21,9 +21,10 @@ jest.mock('react-native-safe-area-context', () => {
|
|||||||
const inset = {top: 0, right: 0, bottom: 0, left: 0}
|
const inset = {top: 0, right: 0, bottom: 0, left: 0}
|
||||||
return {
|
return {
|
||||||
SafeAreaProvider: jest.fn().mockImplementation(({children}) => children),
|
SafeAreaProvider: jest.fn().mockImplementation(({children}) => children),
|
||||||
SafeAreaConsumer: jest
|
SafeAreaConsumer: jest.fn().mockImplementation(
|
||||||
.fn()
|
/** @param {{children: (i: typeof inset) => unknown}} props */
|
||||||
.mockImplementation(({children}) => children(inset)),
|
({children}) => children(inset),
|
||||||
|
),
|
||||||
useSafeAreaInsets: jest.fn().mockImplementation(() => inset),
|
useSafeAreaInsets: jest.fn().mockImplementation(() => inset),
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -85,18 +86,26 @@ jest.mock('expo-application', () => ({
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
jest.mock('expo-modules-core', () => ({
|
jest.mock('expo-modules-core', () => ({
|
||||||
requireNativeModule: jest.fn().mockImplementation(moduleName => {
|
requireNativeModule: jest.fn().mockImplementation(
|
||||||
if (moduleName === 'ExpoPlatformInfo') {
|
/** @param {string} moduleName */
|
||||||
return {
|
moduleName => {
|
||||||
getIsReducedMotionEnabled: () => false,
|
if (moduleName === 'ExpoPlatformInfo') {
|
||||||
|
return {
|
||||||
|
getIsReducedMotionEnabled: () => false,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
if (moduleName === 'BottomSheet') {
|
||||||
if (moduleName === 'BottomSheet') {
|
return {
|
||||||
return {
|
dismissAll: () => {},
|
||||||
dismissAll: () => {},
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}),
|
const expoModules = /** @type {Record<string, unknown> | undefined} */ (
|
||||||
|
globalThis.expo?.modules
|
||||||
|
)
|
||||||
|
return expoModules?.[moduleName]
|
||||||
|
},
|
||||||
|
),
|
||||||
requireNativeViewManager: jest.fn().mockImplementation(_ => {
|
requireNativeViewManager: jest.fn().mockImplementation(_ => {
|
||||||
return () => null
|
return () => null
|
||||||
}),
|
}),
|
||||||
|
|||||||
Reference in New Issue
Block a user