2022-12-22 16:32:39 +01:00
|
|
|
import React from 'react'
|
|
|
|
import {render} from '@testing-library/react-native'
|
|
|
|
import {GestureHandlerRootView} from 'react-native-gesture-handler'
|
|
|
|
import {RootSiblingParent} from 'react-native-root-siblings'
|
|
|
|
import {SafeAreaProvider} from 'react-native-safe-area-context'
|
2023-01-17 17:06:00 +01:00
|
|
|
import {RootStoreProvider} from '../src/state'
|
2023-01-24 16:06:27 +01:00
|
|
|
import {ThemeProvider} from '../src/view/lib/ThemeContext'
|
2023-01-17 17:06:00 +01:00
|
|
|
import {mockedRootStore} from '../__mocks__/state-mock'
|
2022-12-22 16:32:39 +01:00
|
|
|
|
2023-01-24 16:06:27 +01:00
|
|
|
const customRender = (ui: any, rootStore?: any) =>
|
2023-01-17 17:06:00 +01:00
|
|
|
render(
|
|
|
|
// eslint-disable-next-line react-native/no-inline-styles
|
2022-12-22 16:32:39 +01:00
|
|
|
<GestureHandlerRootView style={{flex: 1}}>
|
|
|
|
<RootSiblingParent>
|
2023-01-17 17:06:00 +01:00
|
|
|
<RootStoreProvider
|
2023-01-24 16:06:27 +01:00
|
|
|
value={rootStore != null ? rootStore : mockedRootStore}>
|
|
|
|
<ThemeProvider theme="light">
|
|
|
|
<SafeAreaProvider>{ui}</SafeAreaProvider>
|
|
|
|
</ThemeProvider>
|
2022-12-22 16:32:39 +01:00
|
|
|
</RootStoreProvider>
|
|
|
|
</RootSiblingParent>
|
2023-01-17 17:06:00 +01:00
|
|
|
</GestureHandlerRootView>,
|
2022-12-22 16:32:39 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
// re-export everything
|
|
|
|
export * from '@testing-library/react-native'
|
|
|
|
|
|
|
|
// override render method
|
|
|
|
export {customRender as render}
|