@@ -36,6 +36,7 @@ jest.mock('@sentry/browser', () => ({
3636
3737beforeEach ( ( ) => {
3838 mockStartChild . mockClear ( ) ;
39+ mockFinish . mockClear ( ) ;
3940 activeTransaction = new MockSpan ( { op : 'pageload' } ) ;
4041} ) ;
4142
@@ -100,7 +101,9 @@ describe('withProfiler', () => {
100101 } ) ;
101102
102103 it ( 'is not created if hasRenderSpan is false' , ( ) => {
103- const ProfiledComponent = withProfiler ( ( ) => < h1 > Testing</ h1 > , { includeRender : false } ) ;
104+ const ProfiledComponent = withProfiler ( ( ) => < h1 > Testing</ h1 > , {
105+ includeRender : false ,
106+ } ) ;
104107 expect ( mockStartChild ) . toHaveBeenCalledTimes ( 0 ) ;
105108
106109 const component = render ( < ProfiledComponent /> ) ;
@@ -115,32 +118,33 @@ describe('withProfiler', () => {
115118 const ProfiledComponent = withProfiler ( ( props : { num : number } ) => < div > { props . num } </ div > ) ;
116119 const { rerender } = render ( < ProfiledComponent num = { 0 } /> ) ;
117120 expect ( mockStartChild ) . toHaveBeenCalledTimes ( 1 ) ;
121+ expect ( mockFinish ) . toHaveBeenCalledTimes ( 1 ) ;
118122
119123 // Dispatch new props
120124 rerender ( < ProfiledComponent num = { 1 } /> ) ;
121125 expect ( mockStartChild ) . toHaveBeenCalledTimes ( 2 ) ;
122126 expect ( mockStartChild ) . toHaveBeenLastCalledWith ( {
123127 data : { changedProps : [ 'num' ] } ,
124128 description : `<${ UNKNOWN_COMPONENT } >` ,
125- endTimestamp : expect . any ( Number ) ,
126129 op : REACT_UPDATE_OP ,
127130 startTimestamp : expect . any ( Number ) ,
128131 } ) ;
129-
132+ expect ( mockFinish ) . toHaveBeenCalledTimes ( 2 ) ;
130133 // New props yet again
131134 rerender ( < ProfiledComponent num = { 2 } /> ) ;
132135 expect ( mockStartChild ) . toHaveBeenCalledTimes ( 3 ) ;
133136 expect ( mockStartChild ) . toHaveBeenLastCalledWith ( {
134137 data : { changedProps : [ 'num' ] } ,
135138 description : `<${ UNKNOWN_COMPONENT } >` ,
136- endTimestamp : expect . any ( Number ) ,
137139 op : REACT_UPDATE_OP ,
138140 startTimestamp : expect . any ( Number ) ,
139141 } ) ;
142+ expect ( mockFinish ) . toHaveBeenCalledTimes ( 3 ) ;
140143
141144 // Should not create spans if props haven't changed
142145 rerender ( < ProfiledComponent num = { 2 } /> ) ;
143146 expect ( mockStartChild ) . toHaveBeenCalledTimes ( 3 ) ;
147+ expect ( mockFinish ) . toHaveBeenCalledTimes ( 3 ) ;
144148 } ) ;
145149
146150 it ( 'does not get created if hasUpdateSpan is false' , ( ) => {
0 commit comments