From 93ecad01bacfd552b92e7e3b833a916cbcbba812 Mon Sep 17 00:00:00 2001 From: Ruslan Lesiutin Date: Fri, 2 Feb 2024 17:06:38 +0000 Subject: [PATCH] chore: use versioned render in storeOwners test --- .../src/__tests__/storeOwners-test.js | 44 +++++-------------- 1 file changed, 11 insertions(+), 33 deletions(-) diff --git a/packages/react-devtools-shared/src/__tests__/storeOwners-test.js b/packages/react-devtools-shared/src/__tests__/storeOwners-test.js index df388f69a6c06..f4fd6ba2ba826 100644 --- a/packages/react-devtools-shared/src/__tests__/storeOwners-test.js +++ b/packages/react-devtools-shared/src/__tests__/storeOwners-test.js @@ -8,11 +8,11 @@ */ const {printOwnersList} = require('../devtools/utils'); +const {getVersionedRenderImplementation} = require('./utils'); describe('Store owners list', () => { let React; let act; - let legacyRender; let store; beforeEach(() => { @@ -23,9 +23,10 @@ describe('Store owners list', () => { const utils = require('./utils'); act = utils.act; - legacyRender = utils.legacyRender; }); + const {render} = getVersionedRenderImplementation(); + function getFormattedOwnersList(elementID) { const ownersList = store.getOwnersListForElement(elementID); return printOwnersList(ownersList); @@ -43,7 +44,7 @@ describe('Store owners list', () => { const Leaf = () =>
Leaf
; const Intermediate = ({children}) => {children}; - act(() => legacyRender(, document.createElement('div'))); + act(() => render()); expect(store).toMatchInlineSnapshot(` [root] ▾ @@ -80,7 +81,7 @@ describe('Store owners list', () => { {children}, ]; - act(() => legacyRender(, document.createElement('div'))); + act(() => render()); expect(store).toMatchInlineSnapshot(` [root] ▾ @@ -122,14 +123,7 @@ describe('Store owners list', () => { const Leaf = () =>
Leaf
; const Intermediate = ({children}) => {children}; - const container = document.createElement('div'); - - act(() => - legacyRender( - , - container, - ), - ); + act(() => render()); const rootID = store.getElementIDAtIndex(0); expect(store).toMatchInlineSnapshot(` @@ -145,12 +139,7 @@ describe('Store owners list', () => { " `); - act(() => - legacyRender( - , - container, - ), - ); + act(() => render()); expect(store).toMatchInlineSnapshot(` [root] ▾ @@ -166,12 +155,7 @@ describe('Store owners list', () => { " `); - act(() => - legacyRender( - , - container, - ), - ); + act(() => render()); expect(store).toMatchInlineSnapshot(` [root] ▾ @@ -182,12 +166,7 @@ describe('Store owners list', () => { " `); - act(() => - legacyRender( - , - container, - ), - ); + act(() => render()); expect(store).toMatchInlineSnapshot(` [root] @@ -204,8 +183,7 @@ describe('Store owners list', () => { : [, , ]; const Leaf = () =>
Leaf
; - const container = document.createElement('div'); - act(() => legacyRender(, container)); + act(() => render()); const rootID = store.getElementIDAtIndex(0); expect(store).toMatchInlineSnapshot(` @@ -222,7 +200,7 @@ describe('Store owners list', () => { " `); - act(() => legacyRender(, container)); + act(() => render()); expect(store).toMatchInlineSnapshot(` [root] ▾