@@ -3,6 +3,7 @@ import { render } from '@testing-library/react';
3
3
import { renderHook } from '@testing-library/react-hooks' ;
4
4
import * as React from 'react' ;
5
5
6
+ import { REACT_MOUNT_OP , REACT_RENDER_OP , REACT_UPDATE_OP } from '../src/constants' ;
6
7
import { UNKNOWN_COMPONENT , useProfiler , withProfiler } from '../src/profiler' ;
7
8
8
9
const mockStartChild = jest . fn ( ( spanArgs : SpanContext ) => ( { ...spanArgs } ) ) ;
@@ -76,7 +77,7 @@ describe('withProfiler', () => {
76
77
expect ( mockStartChild ) . toHaveBeenCalledTimes ( 1 ) ;
77
78
expect ( mockStartChild ) . toHaveBeenLastCalledWith ( {
78
79
description : `<${ UNKNOWN_COMPONENT } >` ,
79
- op : 'react.mount' ,
80
+ op : REACT_MOUNT_OP ,
80
81
} ) ;
81
82
} ) ;
82
83
} ) ;
@@ -93,7 +94,7 @@ describe('withProfiler', () => {
93
94
expect ( mockStartChild ) . toHaveBeenLastCalledWith ( {
94
95
description : `<${ UNKNOWN_COMPONENT } >` ,
95
96
endTimestamp : expect . any ( Number ) ,
96
- op : 'react.render' ,
97
+ op : REACT_RENDER_OP ,
97
98
startTimestamp : undefined ,
98
99
} ) ;
99
100
} ) ;
@@ -122,7 +123,7 @@ describe('withProfiler', () => {
122
123
data : { changedProps : [ 'num' ] } ,
123
124
description : `<${ UNKNOWN_COMPONENT } >` ,
124
125
endTimestamp : expect . any ( Number ) ,
125
- op : 'react.update' ,
126
+ op : REACT_UPDATE_OP ,
126
127
startTimestamp : expect . any ( Number ) ,
127
128
} ) ;
128
129
@@ -133,7 +134,7 @@ describe('withProfiler', () => {
133
134
data : { changedProps : [ 'num' ] } ,
134
135
description : `<${ UNKNOWN_COMPONENT } >` ,
135
136
endTimestamp : expect . any ( Number ) ,
136
- op : 'react.update' ,
137
+ op : REACT_UPDATE_OP ,
137
138
startTimestamp : expect . any ( Number ) ,
138
139
} ) ;
139
140
@@ -169,7 +170,7 @@ describe('useProfiler()', () => {
169
170
expect ( mockStartChild ) . toHaveBeenCalledTimes ( 1 ) ;
170
171
expect ( mockStartChild ) . toHaveBeenLastCalledWith ( {
171
172
description : '<Example>' ,
172
- op : 'react.mount' ,
173
+ op : REACT_MOUNT_OP ,
173
174
} ) ;
174
175
} ) ;
175
176
} ) ;
@@ -191,7 +192,7 @@ describe('useProfiler()', () => {
191
192
expect ( mockStartChild ) . toHaveBeenLastCalledWith (
192
193
expect . objectContaining ( {
193
194
description : '<Example>' ,
194
- op : 'react.render' ,
195
+ op : REACT_RENDER_OP ,
195
196
} ) ,
196
197
) ;
197
198
} ) ;
0 commit comments