Skip to content

Commit ad32f94

Browse files
authored
test(tracing): Check if beforeNavigate does not change source (#7473)
1 parent 20b46a8 commit ad32f94

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

packages/tracing-internal/test/browser/browsertracing.test.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,18 +308,20 @@ describe('BrowserTracing', () => {
308308
expect(mockBeforeNavigation).toHaveBeenCalledTimes(1);
309309
});
310310

311-
it('sets transaction name source to default `custom` if name is not changed', () => {
311+
it('sets transaction name source to default `url` if name is not changed', () => {
312312
const mockBeforeNavigation = jest.fn(ctx => ({
313313
...ctx,
314314
}));
315315
createBrowserTracing(true, {
316316
beforeNavigate: mockBeforeNavigation,
317-
routingInstrumentation: customInstrumentRouting,
317+
routingInstrumentation: (customStartTransaction: (obj: any) => void) => {
318+
customStartTransaction({ name: 'a/path', op: 'pageload', metadata: { source: 'url' } });
319+
},
318320
});
319321
const transaction = getActiveTransaction(hub) as IdleTransaction;
320322
expect(transaction).toBeDefined();
321323
expect(transaction.name).toBe('a/path');
322-
expect(transaction.metadata.source).toBe('custom');
324+
expect(transaction.metadata.source).toBe('url');
323325

324326
expect(mockBeforeNavigation).toHaveBeenCalledTimes(1);
325327
});

0 commit comments

Comments
 (0)