Skip to content

Commit c2dff45

Browse files
committed
chore: use versioned render in storeOwners test
1 parent e51cda5 commit c2dff45

File tree

1 file changed

+11
-33
lines changed

1 file changed

+11
-33
lines changed

packages/react-devtools-shared/src/__tests__/storeOwners-test.js

Lines changed: 11 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
*/
99

1010
const {printOwnersList} = require('../devtools/utils');
11+
const {getVersionedRenderImplementation} = require('./utils');
1112

1213
describe('Store owners list', () => {
1314
let React;
1415
let act;
15-
let legacyRender;
1616
let store;
1717

1818
beforeEach(() => {
@@ -23,9 +23,10 @@ describe('Store owners list', () => {
2323

2424
const utils = require('./utils');
2525
act = utils.act;
26-
legacyRender = utils.legacyRender;
2726
});
2827

28+
const {render} = getVersionedRenderImplementation();
29+
2930
function getFormattedOwnersList(elementID) {
3031
const ownersList = store.getOwnersListForElement(elementID);
3132
return printOwnersList(ownersList);
@@ -43,7 +44,7 @@ describe('Store owners list', () => {
4344
const Leaf = () => <div>Leaf</div>;
4445
const Intermediate = ({children}) => <Wrapper>{children}</Wrapper>;
4546

46-
act(() => legacyRender(<Root />, document.createElement('div')));
47+
act(() => render(<Root />));
4748
expect(store).toMatchInlineSnapshot(`
4849
[root]
4950
▾ <Root>
@@ -80,7 +81,7 @@ describe('Store owners list', () => {
8081
<Wrapper key="wrapper">{children}</Wrapper>,
8182
];
8283

83-
act(() => legacyRender(<Root />, document.createElement('div')));
84+
act(() => render(<Root />));
8485
expect(store).toMatchInlineSnapshot(`
8586
[root]
8687
▾ <Root>
@@ -122,14 +123,7 @@ describe('Store owners list', () => {
122123
const Leaf = () => <div>Leaf</div>;
123124
const Intermediate = ({children}) => <Wrapper>{children}</Wrapper>;
124125

125-
const container = document.createElement('div');
126-
127-
act(() =>
128-
legacyRender(
129-
<Root includeDirect={false} includeIndirect={true} />,
130-
container,
131-
),
132-
);
126+
act(() => render(<Root includeDirect={false} includeIndirect={true} />));
133127

134128
const rootID = store.getElementIDAtIndex(0);
135129
expect(store).toMatchInlineSnapshot(`
@@ -145,12 +139,7 @@ describe('Store owners list', () => {
145139
<Leaf>"
146140
`);
147141

148-
act(() =>
149-
legacyRender(
150-
<Root includeDirect={true} includeIndirect={true} />,
151-
container,
152-
),
153-
);
142+
act(() => render(<Root includeDirect={true} includeIndirect={true} />));
154143
expect(store).toMatchInlineSnapshot(`
155144
[root]
156145
▾ <Root>
@@ -166,12 +155,7 @@ describe('Store owners list', () => {
166155
<Leaf>"
167156
`);
168157

169-
act(() =>
170-
legacyRender(
171-
<Root includeDirect={true} includeIndirect={false} />,
172-
container,
173-
),
174-
);
158+
act(() => render(<Root includeDirect={true} includeIndirect={false} />));
175159
expect(store).toMatchInlineSnapshot(`
176160
[root]
177161
▾ <Root>
@@ -182,12 +166,7 @@ describe('Store owners list', () => {
182166
<Leaf>"
183167
`);
184168

185-
act(() =>
186-
legacyRender(
187-
<Root includeDirect={false} includeIndirect={false} />,
188-
container,
189-
),
190-
);
169+
act(() => render(<Root includeDirect={false} includeIndirect={false} />));
191170
expect(store).toMatchInlineSnapshot(`
192171
[root]
193172
<Root>
@@ -204,8 +183,7 @@ describe('Store owners list', () => {
204183
: [<Leaf key="C" />, <Leaf key="B" />, <Leaf key="A" />];
205184
const Leaf = () => <div>Leaf</div>;
206185

207-
const container = document.createElement('div');
208-
act(() => legacyRender(<Root ascending={true} />, container));
186+
act(() => render(<Root ascending={true} />));
209187

210188
const rootID = store.getElementIDAtIndex(0);
211189
expect(store).toMatchInlineSnapshot(`
@@ -222,7 +200,7 @@ describe('Store owners list', () => {
222200
<Leaf key="C">"
223201
`);
224202

225-
act(() => legacyRender(<Root ascending={false} />, container));
203+
act(() => render(<Root ascending={false} />));
226204
expect(store).toMatchInlineSnapshot(`
227205
[root]
228206
▾ <Root>

0 commit comments

Comments
 (0)