@samitouri / QOS-React-1 / commits / 7e77e29ca9

chore: use versioned render in componentStacks test (#28214)

Ruslan Lesiutin committed Feb 5, 2024 at 17:14 UTC 7e77e29ca93857b68bfc31bcd5cd566b33b7cd15
1 file changed +5 -8
packages/react-devtools-shared/src/__tests__/componentStacks-test.js
+5 -8
@@ -7,12 +7,11 @@
7 * @flow
8 */
9
10 -import {normalizeCodeLocInfo} from './utils';
10 +import {getVersionedRenderImplementation, normalizeCodeLocInfo} from './utils';
11
12 describe('component stack', () => {
13 let React;
14 let act;
15 - let legacyRender;
15 let mockError;
16 let mockWarn;
17
@@ -30,11 +29,12 @@ describe('component stack', () => {
29
30 const utils = require('./utils');
31 act = utils.act;
33 - legacyRender = utils.legacyRender;
32
33 React = require('react');
34 });
35
36 + const {render} = getVersionedRenderImplementation();
37 +
38 // @reactVersion >=16.9
39 it('should log the current component stack along with an error or warning', () => {
40 const Grandparent = () => <Parent />;
@@ -45,9 +45,7 @@ describe('component stack', () => {
45 return null;
46 };
47
48 - const container = document.createElement('div');
49 -
50 - act(() => legacyRender(<Grandparent />, container));
48 + act(() => render(<Grandparent />));
49
50 expect(mockError).toHaveBeenCalledWith(
51 'Test error.',
@@ -79,8 +77,7 @@ describe('component stack', () => {
77 return null;
78 };
79
82 - const container = document.createElement('div');
83 - act(() => legacyRender(<Example test="abc" />, container));
80 + act(() => render(<Example test="abc" />));
81
82 expect(useEffectCount).toBe(1);
83