Skip to content

Commit

Permalink
Fix type-test
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed Sep 27, 2021
1 parent ffa2221 commit dc03098
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
5 changes: 2 additions & 3 deletions types/index.d.ts
Expand Up @@ -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'

Expand Down Expand Up @@ -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<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>
Expand Down
11 changes: 11 additions & 0 deletions types/test.tsx
Expand Up @@ -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 <div>{children}</div>
}

return pure.render(ui, {wrapper: Wrapper, ...options})
}

/*
eslint
testing-library/prefer-explicit-assert: "off",
Expand Down

0 comments on commit dc03098

Please sign in to comment.