From 30cc86879a23e5500c3a077ed6bfaaea22d984d6 Mon Sep 17 00:00:00 2001 From: Ruslan Lesiutin Date: Mon, 5 Feb 2024 17:18:32 +0000 Subject: [PATCH] chore: use versioned render in profilingCharts test (#28235) --- .../src/__tests__/profilingCharts-test.js | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/packages/react-devtools-shared/src/__tests__/profilingCharts-test.js b/packages/react-devtools-shared/src/__tests__/profilingCharts-test.js index d59d616d67e61..41d9093feeb54 100644 --- a/packages/react-devtools-shared/src/__tests__/profilingCharts-test.js +++ b/packages/react-devtools-shared/src/__tests__/profilingCharts-test.js @@ -9,10 +9,11 @@ import type Store from 'react-devtools-shared/src/devtools/store'; +import {getVersionedRenderImplementation} from './utils'; + describe('profiling charts', () => { let React; let Scheduler; - let legacyRender; let store: Store; let utils; @@ -20,8 +21,6 @@ describe('profiling charts', () => { utils = require('./utils'); utils.beforeEachProfiling(); - legacyRender = utils.legacyRender; - store = global.store; store.collapseNodesByDefault = false; store.recordChangeDescriptions = true; @@ -30,6 +29,8 @@ describe('profiling charts', () => { Scheduler = require('scheduler'); }); + const {render} = getVersionedRenderImplementation(); + function getFlamegraphChartData(rootID, commitIndex) { const commitTree = store.profilerStore.profilingCache.getCommitTree({ commitIndex, @@ -78,11 +79,9 @@ describe('profiling charts', () => { return null; }); - const container = document.createElement('div'); - utils.act(() => store.profilerStore.startProfiling()); - utils.act(() => legacyRender(, container)); + utils.act(() => render()); expect(store).toMatchInlineSnapshot(` [root] ▾ @@ -91,7 +90,7 @@ describe('profiling charts', () => { [Memo] `); - utils.act(() => legacyRender(, container)); + utils.act(() => render()); expect(store).toMatchInlineSnapshot(` [root] ▾ @@ -228,11 +227,9 @@ describe('profiling charts', () => { return null; }); - const container = document.createElement('div'); - utils.act(() => store.profilerStore.startProfiling()); - utils.act(() => legacyRender(, container)); + utils.act(() => render()); expect(store).toMatchInlineSnapshot(` [root] ▾ @@ -241,7 +238,7 @@ describe('profiling charts', () => { [Memo] `); - utils.act(() => legacyRender(, container)); + utils.act(() => render()); expect(store).toMatchInlineSnapshot(` [root] ▾