Skip to content

Commit

Permalink
chore: use versioned render in profilerChangeDescriptions test
Browse files Browse the repository at this point in the history
  • Loading branch information
hoxyq committed Feb 5, 2024
1 parent 596827f commit 98d6a85
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,26 @@
* @flow
*/

import {getVersionedRenderImplementation} from './utils';

describe('Profiler change descriptions', () => {
let React;
let legacyRender;
let store;
let utils;

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

legacyRender = utils.legacyRender;

store = global.store;
store.collapseNodesByDefault = false;
store.recordChangeDescriptions = true;

React = require('react');
});

const {render} = getVersionedRenderImplementation();

// @reactVersion >=18.0
it('should identify useContext as the cause for a re-render', () => {
const Context = React.createContext(0);
Expand Down Expand Up @@ -62,10 +63,8 @@ describe('Profiler change descriptions', () => {
);
};

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

utils.act(() => store.profilerStore.startProfiling());
utils.act(() => legacyRender(<App />, container));
utils.act(() => render(<App />));
utils.act(() => forceUpdate());
utils.act(() => store.profilerStore.stopProfiling());

Expand Down

0 comments on commit 98d6a85

Please sign in to comment.