@@ -11,7 +11,7 @@ describe('React Router v4', () => {
11
11
startTransactionOnPageLoad ?: boolean ;
12
12
startTransactionOnLocationChange ?: boolean ;
13
13
routes ?: RouteConfig [ ] ;
14
- } ) : [ jest . Mock , any , { mockSetName : jest . Mock ; mockFinish : jest . Mock ; mockSetMetadata : jest . Mock } ] {
14
+ } ) : [ jest . Mock , any , { mockSetName : jest . Mock ; mockFinish : jest . Mock } ] {
15
15
const options = {
16
16
matchPath : _opts && _opts . routes !== undefined ? matchPath : undefined ,
17
17
routes : undefined ,
@@ -22,16 +22,13 @@ describe('React Router v4', () => {
22
22
const history = createMemoryHistory ( ) ;
23
23
const mockFinish = jest . fn ( ) ;
24
24
const mockSetName = jest . fn ( ) ;
25
- const mockSetMetadata = jest . fn ( ) ;
26
- const mockStartTransaction = jest
27
- . fn ( )
28
- . mockReturnValue ( { setName : mockSetName , finish : mockFinish , setMetadata : mockSetMetadata } ) ;
25
+ const mockStartTransaction = jest . fn ( ) . mockReturnValue ( { setName : mockSetName , finish : mockFinish } ) ;
29
26
reactRouterV4Instrumentation ( history , options . routes , options . matchPath ) (
30
27
mockStartTransaction ,
31
28
options . startTransactionOnPageLoad ,
32
29
options . startTransactionOnLocationChange ,
33
30
) ;
34
- return [ mockStartTransaction , history , { mockSetName, mockFinish, mockSetMetadata } ] ;
31
+ return [ mockStartTransaction , history , { mockSetName, mockFinish } ] ;
35
32
}
36
33
37
34
it ( 'starts a pageload transaction when instrumentation is started' , ( ) => {
@@ -164,7 +161,7 @@ describe('React Router v4', () => {
164
161
} ) ;
165
162
166
163
it ( 'normalizes transaction name with custom Route' , ( ) => {
167
- const [ mockStartTransaction , history , { mockSetName, mockSetMetadata } ] = createInstrumentation ( ) ;
164
+ const [ mockStartTransaction , history , { mockSetName } ] = createInstrumentation ( ) ;
168
165
const SentryRoute = withSentryRouting ( Route ) ;
169
166
const { getByText } = render (
170
167
< Router history = { history } >
@@ -189,12 +186,11 @@ describe('React Router v4', () => {
189
186
metadata : { source : 'url' } ,
190
187
} ) ;
191
188
expect ( mockSetName ) . toHaveBeenCalledTimes ( 2 ) ;
192
- expect ( mockSetName ) . toHaveBeenLastCalledWith ( '/users/:userid' ) ;
193
- expect ( mockSetMetadata ) . toHaveBeenLastCalledWith ( { source : 'route' } ) ;
189
+ expect ( mockSetName ) . toHaveBeenLastCalledWith ( '/users/:userid' , 'route' ) ;
194
190
} ) ;
195
191
196
192
it ( 'normalizes nested transaction names with custom Route' , ( ) => {
197
- const [ mockStartTransaction , history , { mockSetName, mockSetMetadata } ] = createInstrumentation ( ) ;
193
+ const [ mockStartTransaction , history , { mockSetName } ] = createInstrumentation ( ) ;
198
194
const SentryRoute = withSentryRouting ( Route ) ;
199
195
const { getByText } = render (
200
196
< Router history = { history } >
@@ -219,8 +215,7 @@ describe('React Router v4', () => {
219
215
metadata : { source : 'url' } ,
220
216
} ) ;
221
217
expect ( mockSetName ) . toHaveBeenCalledTimes ( 2 ) ;
222
- expect ( mockSetName ) . toHaveBeenLastCalledWith ( '/organizations/:orgid/v1/:teamid' ) ;
223
- expect ( mockSetMetadata ) . toHaveBeenLastCalledWith ( { source : 'route' } ) ;
218
+ expect ( mockSetName ) . toHaveBeenLastCalledWith ( '/organizations/:orgid/v1/:teamid' , 'route' ) ;
224
219
225
220
act ( ( ) => {
226
221
history . push ( '/organizations/543' ) ;
@@ -235,8 +230,7 @@ describe('React Router v4', () => {
235
230
metadata : { source : 'url' } ,
236
231
} ) ;
237
232
expect ( mockSetName ) . toHaveBeenCalledTimes ( 3 ) ;
238
- expect ( mockSetName ) . toHaveBeenLastCalledWith ( '/organizations/:orgid' ) ;
239
- expect ( mockSetMetadata ) . toHaveBeenLastCalledWith ( { source : 'route' } ) ;
233
+ expect ( mockSetName ) . toHaveBeenLastCalledWith ( '/organizations/:orgid' , 'route' ) ;
240
234
} ) ;
241
235
242
236
it ( 'matches with route object' , ( ) => {
0 commit comments