|
1 |
| -import TestRenderer from 'react-test-renderer'; |
2 | 1 | import type { ReactTestInstance, ReactTestRenderer } from 'react-test-renderer';
|
3 | 2 | import * as React from 'react';
|
4 | 3 | import { Profiler } from 'react';
|
5 | 4 | import act from './act';
|
6 | 5 | import { addToCleanupQueue } from './cleanup';
|
7 |
| -import debugShallow from './helpers/debugShallow'; |
8 |
| -import debugDeep, { DebugOptions } from './helpers/debugDeep'; |
9 |
| -import { getQueriesForElement } from './within'; |
10 |
| -import { setRenderResult, screen } from './screen'; |
11 |
| -import { validateStringsRenderedWithinText } from './helpers/stringValidation'; |
12 | 6 | import { getConfig } from './config';
|
13 | 7 | import { getHostChildren } from './helpers/component-tree';
|
| 8 | +import debugDeep, { DebugOptions } from './helpers/debugDeep'; |
| 9 | +import debugShallow from './helpers/debugShallow'; |
14 | 10 | import { configureHostComponentNamesIfNeeded } from './helpers/host-component-names';
|
| 11 | +import { validateStringsRenderedWithinText } from './helpers/stringValidation'; |
| 12 | +import { renderWithAct } from './render-act'; |
| 13 | +import { setRenderResult, screen } from './screen'; |
| 14 | +import { getQueriesForElement } from './within'; |
15 | 15 |
|
16 | 16 | export type RenderOptions = {
|
17 | 17 | wrapper?: React.ComponentType<any>;
|
18 | 18 | createNodeMock?: (element: React.ReactElement) => any;
|
19 | 19 | unstable_validateStringsRenderedWithinText?: boolean;
|
20 | 20 | };
|
21 | 21 |
|
22 |
| -type TestRendererOptions = { |
23 |
| - createNodeMock: (element: React.ReactElement) => any; |
24 |
| -}; |
25 |
| - |
26 | 22 | export type RenderResult = ReturnType<typeof render>;
|
27 | 23 |
|
28 | 24 | /**
|
@@ -129,20 +125,6 @@ function buildRenderResult(
|
129 | 125 | return result;
|
130 | 126 | }
|
131 | 127 |
|
132 |
| -function renderWithAct( |
133 |
| - component: React.ReactElement, |
134 |
| - options?: TestRendererOptions |
135 |
| -): ReactTestRenderer { |
136 |
| - let renderer: ReactTestRenderer; |
137 |
| - |
138 |
| - act(() => { |
139 |
| - renderer = TestRenderer.create(component, options); |
140 |
| - }); |
141 |
| - |
142 |
| - // @ts-ignore act is sync, so renderer is always initialised here |
143 |
| - return renderer; |
144 |
| -} |
145 |
| - |
146 | 128 | function updateWithAct(
|
147 | 129 | renderer: ReactTestRenderer,
|
148 | 130 | wrap: (innerElement: React.ReactElement) => React.ReactElement
|
|
0 commit comments