Skip to content

Commit 7ee2bb7

Browse files
committed
fixup! test: Add serverFn spans | wrap with wrapFetchWithSentry
1 parent 59f40bc commit 7ee2bb7

1 file changed

Lines changed: 22 additions & 20 deletions

File tree

  • dev-packages/e2e-tests/test-applications/tanstackstart-react-cloudflare/tests

dev-packages/e2e-tests/test-applications/tanstackstart-react-cloudflare/tests/transaction.test.ts

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,24 @@ test('Sends a server function transaction with span from wrapFetchWithSentry', a
1717

1818
const transactionEvent = await transactionEventPromise;
1919

20-
expect(Array.isArray(transactionEvent?.spans)).toBe(true);
21-
expect(transactionEvent?.spans).toEqual(
22-
expect.arrayContaining([
23-
expect.objectContaining({
24-
description: expect.stringContaining('GET /_serverFn/'),
25-
op: 'function.tanstackstart',
26-
origin: 'auto.function.tanstackstart.server',
27-
data: expect.objectContaining({
28-
'sentry.op': 'function.tanstackstart',
29-
'sentry.origin': 'auto.function.tanstackstart.server',
30-
'tanstackstart.function.hash.sha256': expect.any(String),
31-
}),
20+
expect(transactionEvent.contexts?.trace).toMatchObject({
21+
op: 'http.server',
22+
origin: 'auto.http.cloudflare',
23+
});
24+
25+
expect(transactionEvent?.spans).toHaveLength(1);
26+
expect(transactionEvent?.spans).toEqual([
27+
expect.objectContaining({
28+
description: expect.stringContaining('GET /_serverFn/'),
29+
op: 'function.tanstackstart',
30+
origin: 'auto.function.tanstackstart.server',
31+
data: expect.objectContaining({
32+
'sentry.op': 'function.tanstackstart',
33+
'sentry.origin': 'auto.function.tanstackstart.server',
34+
'tanstackstart.function.hash.sha256': expect.any(String),
3235
}),
33-
]),
34-
);
36+
}),
37+
]);
3538
});
3639

3740
test('Sends a server function transaction for a nested server function with manual span', async ({ page }) => {
@@ -50,8 +53,12 @@ test('Sends a server function transaction for a nested server function with manu
5053

5154
const transactionEvent = await transactionEventPromise;
5255

53-
expect(Array.isArray(transactionEvent?.spans)).toBe(true);
56+
expect(transactionEvent.contexts?.trace).toMatchObject({
57+
op: 'http.server',
58+
origin: 'auto.http.cloudflare',
59+
});
5460

61+
expect(transactionEvent?.spans).toHaveLength(2);
5562
expect(transactionEvent?.spans).toEqual(
5663
expect.arrayContaining([
5764
expect.objectContaining({
@@ -64,11 +71,6 @@ test('Sends a server function transaction for a nested server function with manu
6471
'tanstackstart.function.hash.sha256': expect.any(String),
6572
}),
6673
}),
67-
]),
68-
);
69-
70-
expect(transactionEvent?.spans).toEqual(
71-
expect.arrayContaining([
7274
expect.objectContaining({
7375
description: 'testNestedLog',
7476
origin: 'manual',

0 commit comments

Comments
 (0)