88 pagesRouterInstrumentNavigation ,
99 pagesRouterInstrumentPageLoad ,
1010} from '../../src/client/routing/pagesRouterRoutingInstrumentation' ;
11+ import { URL_TEMPLATE } from '@sentry/conventions/attributes' ;
1112
1213const globalObject = WINDOW as typeof WINDOW & {
1314 __BUILD_MANIFEST ?: {
@@ -128,6 +129,7 @@ describe('pagesRouterInstrumentPageLoad', () => {
128129 'sentry.op' : 'pageload' ,
129130 'sentry.origin' : 'auto.pageload.nextjs.pages_router_instrumentation' ,
130131 'sentry.source' : 'route' ,
132+ [ URL_TEMPLATE ] : '/[user]/posts/[id]' ,
131133 user : 'chargome' ,
132134 id : '1337' ,
133135 q : '42' ,
@@ -151,6 +153,7 @@ describe('pagesRouterInstrumentPageLoad', () => {
151153 'sentry.op' : 'pageload' ,
152154 'sentry.origin' : 'auto.pageload.nextjs.pages_router_instrumentation' ,
153155 'sentry.source' : 'route' ,
156+ [ URL_TEMPLATE ] : '/some-page' ,
154157 } ,
155158 } ,
156159 ] ,
@@ -166,6 +169,7 @@ describe('pagesRouterInstrumentPageLoad', () => {
166169 'sentry.op' : 'pageload' ,
167170 'sentry.origin' : 'auto.pageload.nextjs.pages_router_instrumentation' ,
168171 'sentry.source' : 'route' ,
172+ [ URL_TEMPLATE ] : '/' ,
169173 } ,
170174 } ,
171175 ] ,
@@ -331,17 +335,20 @@ describe('pagesRouterInstrumentNavigation', () => {
331335 'sentry.op' : 'navigation' ,
332336 'sentry.origin' : 'auto.navigation.nextjs.pages_router_instrumentation' ,
333337 'sentry.source' : expectedTransactionSource ,
338+ ...( expectedTransactionSource === 'route' ? { [ URL_TEMPLATE ] : expectedTransactionName } : { } ) ,
334339 } ,
335340 } ;
336341 expect ( emit ) . toHaveBeenCalledWith (
337342 'beforeStartNavigationSpan' ,
338343 expect . objectContaining ( expectedStartSpanOptions ) ,
339344 {
340345 isRedirect : undefined ,
346+ url : `https://example.com${ targetLocation } ` ,
341347 } ,
342348 ) ;
343349 expect ( emit ) . toHaveBeenCalledWith ( 'startNavigationSpan' , expect . objectContaining ( expectedStartSpanOptions ) , {
344350 isRedirect : undefined ,
351+ url : `https://example.com${ targetLocation } ` ,
345352 } ) ;
346353 } ,
347354 ) ;
0 commit comments