@@ -321,19 +321,25 @@ describe('pagesRouterInstrumentNavigation', () => {
321
321
322
322
Router . events . emit ( 'routeChangeStart' , targetLocation ) ;
323
323
324
- expect ( emit ) . toHaveBeenCalledTimes ( 1 ) ;
324
+ expect ( emit ) . toHaveBeenCalledTimes ( 2 ) ;
325
+ const expectedStartSpanOptions = {
326
+ name : expectedTransactionName ,
327
+ attributes : {
328
+ 'sentry.op' : 'navigation' ,
329
+ 'sentry.origin' : 'auto.navigation.nextjs.pages_router_instrumentation' ,
330
+ 'sentry.source' : expectedTransactionSource ,
331
+ } ,
332
+ } ;
325
333
expect ( emit ) . toHaveBeenCalledWith (
326
- 'startNavigationSpan' ,
327
- expect . objectContaining ( {
328
- name : expectedTransactionName ,
329
- attributes : {
330
- 'sentry.op' : 'navigation' ,
331
- 'sentry.origin' : 'auto.navigation.nextjs.pages_router_instrumentation' ,
332
- 'sentry.source' : expectedTransactionSource ,
333
- } ,
334
- } ) ,
335
- { isRedirect : undefined } ,
334
+ 'beforeStartNavigationSpan' ,
335
+ expect . objectContaining ( expectedStartSpanOptions ) ,
336
+ {
337
+ isRedirect : undefined ,
338
+ } ,
336
339
) ;
340
+ expect ( emit ) . toHaveBeenCalledWith ( 'startNavigationSpan' , expect . objectContaining ( expectedStartSpanOptions ) , {
341
+ isRedirect : undefined ,
342
+ } ) ;
337
343
} ,
338
344
) ;
339
345
} ) ;
0 commit comments