diff --git a/types/index.d.ts b/types/index.d.ts index 663e6280..3baf7b5e 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -70,7 +70,7 @@ export interface RenderOptions< * * @see https://testing-library.com/docs/react-testing-library/api/#wrapper */ - wrapper?: React.ComponentType + wrapper?: React.ComponentType<{children: React.ReactElement}> } type Omit = Pick> diff --git a/types/test.tsx b/types/test.tsx index 239caed6..7c45eaae 100644 --- a/types/test.tsx +++ b/types/test.tsx @@ -100,6 +100,28 @@ export function testQueries() { ) } +export function wrappedRender( + ui: React.ReactElement, + options?: pure.RenderOptions, +) { + const Wrapper = ({children}: {children: React.ReactElement}): JSX.Element => { + return
{children}
+ } + + return pure.render(ui, {wrapper: Wrapper, ...options}) +} + +export function wrappedRenderB( + ui: React.ReactElement, + options?: pure.RenderOptions, +) { + const Wrapper: React.FunctionComponent = ({children}) => { + return
{children}
+ } + + return pure.render(ui, {wrapper: Wrapper, ...options}) +} + /* eslint testing-library/prefer-explicit-assert: "off",