Skip to content

Commit

Permalink
chore: use versioned render in profilingCharts test
Browse files Browse the repository at this point in the history
  • Loading branch information
hoxyq committed Feb 2, 2024
1 parent e51cda5 commit f23c054
Showing 1 changed file with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,18 @@

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;

beforeEach(() => {
utils = require('./utils');
utils.beforeEachProfiling();

legacyRender = utils.legacyRender;

store = global.store;
store.collapseNodesByDefault = false;
store.recordChangeDescriptions = true;
Expand All @@ -30,6 +29,8 @@ describe('profiling charts', () => {
Scheduler = require('scheduler');
});

const {render} = getVersionedRenderImplementation();

function getFlamegraphChartData(rootID, commitIndex) {
const commitTree = store.profilerStore.profilingCache.getCommitTree({
commitIndex,
Expand Down Expand Up @@ -78,11 +79,9 @@ describe('profiling charts', () => {
return null;
});

const container = document.createElement('div');

utils.act(() => store.profilerStore.startProfiling());

utils.act(() => legacyRender(<Parent />, container));
utils.act(() => render(<Parent />));
expect(store).toMatchInlineSnapshot(`
[root]
▾ <Parent>
Expand All @@ -91,7 +90,7 @@ describe('profiling charts', () => {
<Child key="third"> [Memo]
`);

utils.act(() => legacyRender(<Parent />, container));
utils.act(() => render(<Parent />));
expect(store).toMatchInlineSnapshot(`
[root]
▾ <Parent>
Expand Down Expand Up @@ -228,11 +227,9 @@ describe('profiling charts', () => {
return null;
});

const container = document.createElement('div');

utils.act(() => store.profilerStore.startProfiling());

utils.act(() => legacyRender(<Parent />, container));
utils.act(() => render(<Parent />));
expect(store).toMatchInlineSnapshot(`
[root]
▾ <Parent>
Expand All @@ -241,7 +238,7 @@ describe('profiling charts', () => {
<Child key="third"> [Memo]
`);

utils.act(() => legacyRender(<Parent />, container));
utils.act(() => render(<Parent />));
expect(store).toMatchInlineSnapshot(`
[root]
▾ <Parent>
Expand Down

0 comments on commit f23c054

Please sign in to comment.