mirror of
https://github.com/zebrajr/react.git
synced 2026-01-15 12:15:22 +00:00
chore: use versioned render in componentStacks test (#28214)
This commit is contained in:
@@ -7,12 +7,11 @@
|
||||
* @flow
|
||||
*/
|
||||
|
||||
import {normalizeCodeLocInfo} from './utils';
|
||||
import {getVersionedRenderImplementation, normalizeCodeLocInfo} from './utils';
|
||||
|
||||
describe('component stack', () => {
|
||||
let React;
|
||||
let act;
|
||||
let legacyRender;
|
||||
let mockError;
|
||||
let mockWarn;
|
||||
|
||||
@@ -30,11 +29,12 @@ describe('component stack', () => {
|
||||
|
||||
const utils = require('./utils');
|
||||
act = utils.act;
|
||||
legacyRender = utils.legacyRender;
|
||||
|
||||
React = require('react');
|
||||
});
|
||||
|
||||
const {render} = getVersionedRenderImplementation();
|
||||
|
||||
// @reactVersion >=16.9
|
||||
it('should log the current component stack along with an error or warning', () => {
|
||||
const Grandparent = () => <Parent />;
|
||||
@@ -45,9 +45,7 @@ describe('component stack', () => {
|
||||
return null;
|
||||
};
|
||||
|
||||
const container = document.createElement('div');
|
||||
|
||||
act(() => legacyRender(<Grandparent />, container));
|
||||
act(() => render(<Grandparent />));
|
||||
|
||||
expect(mockError).toHaveBeenCalledWith(
|
||||
'Test error.',
|
||||
@@ -79,8 +77,7 @@ describe('component stack', () => {
|
||||
return null;
|
||||
};
|
||||
|
||||
const container = document.createElement('div');
|
||||
act(() => legacyRender(<Example test="abc" />, container));
|
||||
act(() => render(<Example test="abc" />));
|
||||
|
||||
expect(useEffectCount).toBe(1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user