Skip to content

Commit b47a3fc

Browse files
committed
add test for identical nav origin and destination
1 parent bcf6f19 commit b47a3fc

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

packages/sveltekit/test/client/router.test.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,4 +123,18 @@ describe('sveltekitRoutingInstrumentation', () => {
123123

124124
expect(routingSpanFinishSpy).toHaveBeenCalledTimes(1);
125125
});
126+
127+
it("doesn't start a navigation transaction if navigation origin and destination are equal", () => {
128+
svelteKitRoutingInstrumentation(mockedStartTransaction, false, true);
129+
130+
// We emit an update to the `navigating` store to simulate the SvelteKit navigation lifecycle
131+
// @ts-ignore This is fine because we testUtils/stores.ts defines `navigating` as a writable store
132+
navigating.set({
133+
from: { route: { id: 'testRoute' } },
134+
to: { route: { id: 'testRoute' } },
135+
});
136+
137+
// This should update the transaction name with the parameterized route:
138+
expect(mockedStartTransaction).toHaveBeenCalledTimes(0);
139+
});
126140
});

0 commit comments

Comments
 (0)