Skip to content

Commit

Permalink
chore: use versioned render in ownersListContext test (#28240)
Browse files Browse the repository at this point in the history
  • Loading branch information
hoxyq authored Feb 5, 2024
1 parent 6a21244 commit 86b95ed
Showing 1 changed file with 8 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ import type {Element} from 'react-devtools-shared/src/frontend/types';
import type {FrontendBridge} from 'react-devtools-shared/src/bridge';
import type Store from 'react-devtools-shared/src/devtools/store';

import {getVersionedRenderImplementation} from './utils';

describe('OwnersListContext', () => {
let React;
let TestRenderer: ReactTestRenderer;
let bridge: FrontendBridge;
let legacyRender;
let store: Store;
let utils;

Expand All @@ -30,8 +31,6 @@ describe('OwnersListContext', () => {
utils = require('./utils');
utils.beforeEachProfiling();

legacyRender = utils.legacyRender;

bridge = global.bridge;
store = global.store;
store.collapseNodesByDefault = false;
Expand All @@ -51,6 +50,8 @@ describe('OwnersListContext', () => {
require('react-devtools-shared/src/devtools/views/Components/TreeContext').TreeContextController;
});

const {render} = getVersionedRenderImplementation();

const Contexts = ({children, defaultOwnerID = null}) => (
<BridgeContext.Provider value={bridge}>
<StoreContext.Provider value={store}>
Expand Down Expand Up @@ -98,9 +99,7 @@ describe('OwnersListContext', () => {
};
const Child = () => null;

utils.act(() =>
legacyRender(<Grandparent />, document.createElement('div')),
);
utils.act(() => render(<Grandparent />));

expect(store).toMatchInlineSnapshot(`
[root]
Expand Down Expand Up @@ -143,9 +142,7 @@ describe('OwnersListContext', () => {
};
const Child = () => null;

utils.act(() =>
legacyRender(<Grandparent />, document.createElement('div')),
);
utils.act(() => render(<Grandparent />));

expect(store).toMatchInlineSnapshot(`
[root]
Expand All @@ -171,9 +168,7 @@ describe('OwnersListContext', () => {
const Grandparent = () => <Parent />;
const Parent = () => null;

utils.act(() =>
legacyRender(<Grandparent />, document.createElement('div')),
);
utils.act(() => render(<Grandparent />));

expect(store).toMatchInlineSnapshot(`
[root]
Expand All @@ -198,9 +193,7 @@ describe('OwnersListContext', () => {
return <Memo ref={ref} />;
};

utils.act(() =>
legacyRender(<Grandparent />, document.createElement('div')),
);
utils.act(() => render(<Grandparent />));

expect(store).toMatchInlineSnapshot(`
[root]
Expand Down

0 comments on commit 86b95ed

Please sign in to comment.