Skip to content

Commit 768d7ce

Browse files
committed
fix nextjs unit test
1 parent 1cbd267 commit 768d7ce

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

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

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

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

324-
expect(emit).toHaveBeenCalledTimes(1);
325-
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-
);
324+
expect(emit).toHaveBeenCalledTimes(2);
325+
const expectedSpanOptions = {
326+
name: expectedTransactionName,
327+
attributes: {
328+
'sentry.op': 'navigation',
329+
'sentry.origin': 'auto.navigation.nextjs.pages_router_instrumentation',
330+
'sentry.source': expectedTransactionSource,
331+
},
332+
};
333+
expect(emit).toHaveBeenCalledWith('beforeStartNavigationSpan', expect.objectContaining(expectedSpanOptions));
334+
expect(emit).toHaveBeenCalledWith('startNavigationSpan', expect.objectContaining(expectedSpanOptions));
336335
},
337336
);
338337
});

0 commit comments

Comments
 (0)