Skip to content

Commit

Permalink
chore: use versioned render in profilingCharts test (facebook#28235)
Browse files Browse the repository at this point in the history
  • Loading branch information
hoxyq authored and AndyPengc12 committed Apr 15, 2024
1 parent d4b6358 commit 30cc868
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 30cc868

Please sign in to comment.