7
7
* @flow
8
8
*/
9
9
10
- import { normalizeCodeLocInfo } from './utils' ;
10
+ import { getVersionedRenderImplementation , normalizeCodeLocInfo } from './utils' ;
11
11
12
12
describe ( 'component stack' , ( ) => {
13
13
let React ;
14
14
let act ;
15
- let legacyRender ;
16
15
let mockError ;
17
16
let mockWarn ;
18
17
@@ -30,11 +29,12 @@ describe('component stack', () => {
30
29
31
30
const utils = require ( './utils' ) ;
32
31
act = utils . act ;
33
- legacyRender = utils . legacyRender ;
34
32
35
33
React = require ( 'react' ) ;
36
34
} ) ;
37
35
36
+ const { render} = getVersionedRenderImplementation ( ) ;
37
+
38
38
// @reactVersion >=16.9
39
39
it ( 'should log the current component stack along with an error or warning' , ( ) => {
40
40
const Grandparent = ( ) => < Parent /> ;
@@ -45,9 +45,7 @@ describe('component stack', () => {
45
45
return null ;
46
46
} ;
47
47
48
- const container = document . createElement ( 'div' ) ;
49
-
50
- act ( ( ) => legacyRender ( < Grandparent /> , container ) ) ;
48
+ act ( ( ) => render ( < Grandparent /> ) ) ;
51
49
52
50
expect ( mockError ) . toHaveBeenCalledWith (
53
51
'Test error.' ,
@@ -79,8 +77,7 @@ describe('component stack', () => {
79
77
return null ;
80
78
} ;
81
79
82
- const container = document . createElement ( 'div' ) ;
83
- act ( ( ) => legacyRender ( < Example test = "abc" /> , container ) ) ;
80
+ act ( ( ) => render ( < Example test = "abc" /> ) ) ;
84
81
85
82
expect ( useEffectCount ) . toBe ( 1 ) ;
86
83
0 commit comments