import { ColorScheme , ShareGateTheme , ThemeProvider } from "@components/styling" ; import { ReactElement , ReactNode } from "react" ; import { RenderHookOptions , renderHook } from "@testing-library/react-hooks" ; import { render } from "@testing-library/react" ; export interface JestThemeOptions { colorScheme ? : ColorScheme ; } function withThemeProvider ( { colorScheme = "light" } = { } ) { return { wrapper : ( { children } ) => { return ( < ThemeProvider theme = { ShareGateTheme } colorScheme = { colorScheme } > { children } < /ThemeProvider>); } } ; } export function renderWithTheme ( ui , testingLibraryOptions ? , themeOptions ? ) { return render ( ui , { ... withThemeProvider ( themeOptions ) , ... testingLibraryOptions } ) ; } export function renderHookWithTheme < TProps , TResult > ( callback , renderHookOptions ? , themeOptions ? ) { return renderHook ( callback , { ... withThemeProvider ( themeOptions ) , ... renderHookOptions } ) ; }