2021-07-26 20:41:08 +03:00
|
|
|
import { render, RenderOptions } from '@testing-library/react'
|
2021-09-22 02:21:28 +03:00
|
|
|
import React, { FC, ReactElement, ReactNode } from 'react'
|
2021-07-26 20:41:08 +03:00
|
|
|
import { Provider } from 'react-redux'
|
2021-09-22 02:21:28 +03:00
|
|
|
import store from 'state'
|
|
|
|
import ThemeProvider from 'theme'
|
2021-07-26 20:41:08 +03:00
|
|
|
|
|
|
|
const WithProviders: FC = ({ children }: { children?: ReactNode }) => {
|
|
|
|
return (
|
|
|
|
<Provider store={store}>
|
|
|
|
<ThemeProvider>{children}</ThemeProvider>
|
|
|
|
</Provider>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
const customRender = (ui: ReactElement, options?: Omit<RenderOptions, 'wrapper'>) =>
|
|
|
|
render(ui, { wrapper: WithProviders, ...options })
|
|
|
|
|
|
|
|
export * from '@testing-library/react'
|
|
|
|
export { customRender as render }
|