From dc03098550817b9e222473c97fdc40773847c05f Mon Sep 17 00:00:00 2001 From: eps1lon Date: Mon, 27 Sep 2021 11:38:02 +0200 Subject: [PATCH] Fix type-test --- types/index.d.ts | 5 ++--- types/test.tsx | 11 +++++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/types/index.d.ts b/types/index.d.ts index 65319eda..df5998be 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -6,6 +6,7 @@ import { BoundFunction, prettyFormat, } from '@testing-library/dom' +import React from 'react' import {Renderer} from 'react-dom' import {act as reactAct} from 'react-dom/test-utils' @@ -70,9 +71,7 @@ export interface RenderOptions< * * @see https://testing-library.com/docs/react-testing-library/api/#wrapper */ - wrapper?: - | React.ComponentType - | ((props: {children: React.ReactNode}) => JSX.Element) + wrapper?: React.ComponentType<{children: React.ReactElement}> } type Omit = Pick> diff --git a/types/test.tsx b/types/test.tsx index 29f8ffb2..7c45eaae 100644 --- a/types/test.tsx +++ b/types/test.tsx @@ -111,6 +111,17 @@ export function wrappedRender( 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",