From 86b95edb0ae68a68f7611aca56d3139e7934fb75 Mon Sep 17 00:00:00 2001 From: Ruslan Lesiutin Date: Mon, 5 Feb 2024 17:32:31 +0000 Subject: [PATCH] chore: use versioned render in ownersListContext test (#28240) --- .../src/__tests__/ownersListContext-test.js | 23 +++++++------------ 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/packages/react-devtools-shared/src/__tests__/ownersListContext-test.js b/packages/react-devtools-shared/src/__tests__/ownersListContext-test.js index c02a895feeaec..599492bed54a1 100644 --- a/packages/react-devtools-shared/src/__tests__/ownersListContext-test.js +++ b/packages/react-devtools-shared/src/__tests__/ownersListContext-test.js @@ -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; @@ -30,8 +31,6 @@ describe('OwnersListContext', () => { utils = require('./utils'); utils.beforeEachProfiling(); - legacyRender = utils.legacyRender; - bridge = global.bridge; store = global.store; store.collapseNodesByDefault = false; @@ -51,6 +50,8 @@ describe('OwnersListContext', () => { require('react-devtools-shared/src/devtools/views/Components/TreeContext').TreeContextController; }); + const {render} = getVersionedRenderImplementation(); + const Contexts = ({children, defaultOwnerID = null}) => ( @@ -98,9 +99,7 @@ describe('OwnersListContext', () => { }; const Child = () => null; - utils.act(() => - legacyRender(, document.createElement('div')), - ); + utils.act(() => render()); expect(store).toMatchInlineSnapshot(` [root] @@ -143,9 +142,7 @@ describe('OwnersListContext', () => { }; const Child = () => null; - utils.act(() => - legacyRender(, document.createElement('div')), - ); + utils.act(() => render()); expect(store).toMatchInlineSnapshot(` [root] @@ -171,9 +168,7 @@ describe('OwnersListContext', () => { const Grandparent = () => ; const Parent = () => null; - utils.act(() => - legacyRender(, document.createElement('div')), - ); + utils.act(() => render()); expect(store).toMatchInlineSnapshot(` [root] @@ -198,9 +193,7 @@ describe('OwnersListContext', () => { return ; }; - utils.act(() => - legacyRender(, document.createElement('div')), - ); + utils.act(() => render()); expect(store).toMatchInlineSnapshot(` [root]