-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d3e2ac7
commit 2cd7530
Showing
8 changed files
with
565 additions
and
2,402 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// flow-typed signature: 0c9447942a6ffdb5f79f218bfe8e58d9 | ||
// flow-typed version: fe9fda6713/@testing-library/jest-dom_v5.5.x/flow_>=v0.104.x | ||
|
||
declare module '@testing-library/jest-dom' { | ||
declare type JestMatcherResult = { | ||
message?: string | (() => string), | ||
pass: boolean, | ||
... | ||
}; | ||
|
||
declare type Result = JestMatcherResult | Promise<JestMatcherResult>; | ||
|
||
declare module.exports: {| | ||
/** | ||
* @deprecated | ||
*/ | ||
toBeInTheDOM(container?: HTMLElement): Result, | ||
|
||
toBeInTheDocument(): Result, | ||
toBeVisible(): Result, | ||
toBeEmpty(): Result, | ||
toBeDisabled(): Result, | ||
toBeEnabled(): Result, | ||
toBeInvalid(): Result, | ||
toBeRequired(): Result, | ||
toBeValid(): Result, | ||
toContainElement(element: HTMLElement | null): Result, | ||
toContainHTML(htmlText: string): Result, | ||
toHaveAttribute(attr: string, value?: any): Result, | ||
toHaveClass(...classNames: string[]): Result, | ||
toHaveFocus(): Result, | ||
toHaveFormValues(expectedValues: { [name: string]: any, ... }): Result, | ||
toHaveStyle(css: string | { [name: string]: any, ... }): Result, | ||
toHaveTextContent( | ||
text: string | RegExp, | ||
options?: {| normalizeWhitespace: boolean |} | ||
): Result, | ||
toHaveValue(value?: string | string[] | number): Result, | ||
toHaveDisplayValue(value: string | string[]): Result, | ||
toBeChecked(): Result, | ||
|}; | ||
} | ||
|
||
declare module '@testing-library/jest-dom/extend-expect' { | ||
declare module.exports: any; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
// flow-typed signature: d2327256a96d87ce8dfe5ef5ec7149e4 | ||
// flow-typed version: ec99079dbb/@testing-library/react-hooks_v3.x.x/flow_>=v0.104.x | ||
|
||
// @flow | ||
// Initially adapted from: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/testing-library__react-hooks. | ||
|
||
declare module '@testing-library/react-hooks' { | ||
declare export type RenderHookOptions<P> = {| | ||
+initialProps?: P, | ||
+wrapper?: React$ComponentType<{| | ||
...P, | ||
+children: React$Node, | ||
|}>, | ||
|}; | ||
|
||
declare export type WaitOptions = {| | ||
+interval?: number, | ||
+timeout?: number, | ||
+suppressErrors?: boolean, | ||
|}; | ||
|
||
declare type HookResult<R> = {| | ||
+current: R, | ||
+error?: Error, | ||
|}; | ||
|
||
declare type RenderHookResult<P, R> = {| | ||
+result: HookResult<R>, | ||
+waitForNextUpdate: ( | ||
options?: $Diff<WaitOptions, $Diff<WaitOptions, {| +timeout?: number |}>> | ||
) => Promise<void>, | ||
+waitForValueToChange: ( | ||
selector: () => any, | ||
options?: WaitOptions | ||
) => Promise<void>, | ||
+waitFor: ( | ||
callback: () => boolean | void, | ||
options?: WaitOptions | ||
) => Promise<void>, | ||
+unmount: () => boolean, | ||
+rerender: (newProps?: P) => void, | ||
|}; | ||
|
||
// From `react-test-renderer`. | ||
// See: https://github.com/flow-typed/flow-typed/blob/master/definitions/npm/react-test-renderer_v16.x.x/. | ||
|
||
declare type Thenable = { | ||
then(resolve: () => mixed, reject?: () => mixed): mixed, | ||
... | ||
}; | ||
|
||
/** | ||
* To prepare a component for assertions, wrap the code rendering it and | ||
* performing updates inside an act() call. This makes your test run closer to | ||
* how React works in the browser. | ||
*/ | ||
declare export function act(callback: () => void | Promise<void>): Thenable; | ||
|
||
/** | ||
* Renders a test component that will call the provided `callback`, including | ||
* any hooks it calls, every time it renders. | ||
*/ | ||
declare export function renderHook<P, R>( | ||
callback: (props: P) => R, | ||
options?: RenderHookOptions<P> | ||
): RenderHookResult<P, R>; | ||
|
||
/** | ||
* Unmounts any rendered hooks rendered with `renderHook`, ensuring all | ||
* effects have been flushed. | ||
*/ | ||
declare export function cleanup(): Promise<void>; | ||
} |
Oops, something went wrong.