Skip to content

Commit ed3c762

Browse files
committed
fix nextjs unit test
1 parent bbfa3b2 commit ed3c762

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

packages/nextjs/test/performance/pagesRouterInstrumentation.test.ts

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -321,19 +321,25 @@ describe('pagesRouterInstrumentNavigation', () => {
321321

322322
Router.events.emit('routeChangeStart', targetLocation);
323323

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+
};
325333
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+
},
336339
);
340+
expect(emit).toHaveBeenCalledWith('startNavigationSpan', expect.objectContaining(expectedStartSpanOptions), {
341+
isRedirect: undefined,
342+
});
337343
},
338344
);
339345
});

0 commit comments

Comments
 (0)