1 | import { ElementType, ReactElement } from "react";
|
2 | export {};
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | export interface ReactTestRendererJSON {
|
9 | type: string;
|
10 | props: { [propName: string]: any };
|
11 | children: null | ReactTestRendererNode[];
|
12 | }
|
13 | export type ReactTestRendererNode = ReactTestRendererJSON | string;
|
14 | export interface ReactTestRendererTree extends ReactTestRendererJSON {
|
15 | nodeType: "component" | "host";
|
16 | instance: any;
|
17 | rendered: null | ReactTestRendererTree | ReactTestRendererTree[];
|
18 | }
|
19 | export interface ReactTestInstance {
|
20 | instance: any;
|
21 | type: ElementType;
|
22 | props: { [propName: string]: any };
|
23 | parent: null | ReactTestInstance;
|
24 | children: Array<ReactTestInstance | string>;
|
25 |
|
26 | find(predicate: (node: ReactTestInstance) => boolean): ReactTestInstance;
|
27 | findByType(type: ElementType): ReactTestInstance;
|
28 | findByProps(props: { [propName: string]: any }): ReactTestInstance;
|
29 |
|
30 | findAll(predicate: (node: ReactTestInstance) => boolean, options?: { deep: boolean }): ReactTestInstance[];
|
31 | findAllByType(type: ElementType, options?: { deep: boolean }): ReactTestInstance[];
|
32 | findAllByProps(props: { [propName: string]: any }, options?: { deep: boolean }): ReactTestInstance[];
|
33 | }
|
34 | export interface ReactTestRenderer {
|
35 | toJSON(): null | ReactTestRendererJSON | ReactTestRendererJSON[];
|
36 | toTree(): null | ReactTestRendererTree;
|
37 | unmount(nextElement?: ReactElement): void;
|
38 | update(nextElement: ReactElement): void;
|
39 | getInstance(): null | ReactTestInstance;
|
40 | root: ReactTestInstance;
|
41 | }
|
42 | export interface TestRendererOptions {
|
43 | createNodeMock(element: ReactElement): any;
|
44 | }
|
45 |
|
46 |
|
47 |
|
48 |
|
49 | export function create(nextElement: ReactElement, options?: TestRendererOptions): ReactTestRenderer;
|
50 |
|
51 |
|
52 |
|
53 | declare const UNDEFINED_VOID_ONLY: unique symbol;
|
54 |
|
55 | type VoidOrUndefinedOnly = void | { [UNDEFINED_VOID_ONLY]: never };
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 |
|
67 |
|
68 |
|
69 | export function act(callback: () => Promise<VoidOrUndefinedOnly>): Promise<undefined>;
|
70 |
|
71 |
|
72 |
|
73 |
|
74 |
|
75 |
|
76 |
|
77 |
|
78 |
|
79 |
|
80 |
|
81 |
|
82 | export function act(callback: () => VoidOrUndefinedOnly): DebugPromiseLike;
|
83 |
|
84 |
|
85 |
|
86 | export interface DebugPromiseLike {
|
87 |
|
88 | then(onfulfilled: (value: never) => never, onrejected: (reason: never) => never): never;
|
89 | }
|