Skip to content

Commit 8373f6d

Browse files
committed
more reliable test
1 parent 6efbca3 commit 8373f6d

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/route-handlers.test.ts

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -168,13 +168,25 @@ test.describe('Edge runtime', () => {
168168
expect(edgerouteTransaction2.contexts?.trace?.op).toBe('http.server');
169169
expect(edgerouteTransaction3.contexts?.trace?.op).toBe('http.server');
170170

171-
expect(edgerouteTransaction1.spans?.length).toBe(1);
172-
expect(edgerouteTransaction2.spans?.length).toBe(1);
173-
expect(edgerouteTransaction3.spans?.length).toBe(1);
174-
175-
expect(edgerouteTransaction1.spans?.[0].description).toBe('GET https://github.com/');
176-
expect(edgerouteTransaction2.spans?.[0].description).toBe('GET https://github.com/');
177-
expect(edgerouteTransaction3.spans?.[0].description).toBe('GET https://github.com/');
171+
expect(edgerouteTransaction1.spans).toContainEqual({
172+
description: 'GET https://github.com/',
173+
});
174+
expect(edgerouteTransaction2.spans).toContainEqual({
175+
description: 'GET https://github.com/',
176+
});
177+
expect(edgerouteTransaction3.spans).toContainEqual({
178+
description: 'GET https://github.com/',
179+
});
180+
// Does not contain span that is sent to the event proxy server
181+
expect(edgerouteTransaction1.spans).not.toContainEqual({
182+
description: expect.stringContaining('https://localhost:3031'),
183+
});
184+
expect(edgerouteTransaction2.spans).not.toContainEqual({
185+
description: expect.stringContaining('https://localhost:3031'),
186+
});
187+
expect(edgerouteTransaction3.spans).not.toContainEqual({
188+
description: expect.stringContaining('https://localhost:3031'),
189+
});
178190
});
179191
});
180192

0 commit comments

Comments
 (0)