Skip to content

Commit 9e6b1bb

Browse files
committed
Fix cf tests
1 parent e2ab088 commit 9e6b1bb

5 files changed

Lines changed: 28 additions & 32 deletions

File tree

dev-packages/cloudflare-integration-tests/suites/tracing/anthropic-ai/test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ it('traces a basic message creation request', async ({ signal }) => {
2020
const runner = createRunner(__dirname)
2121
.ignore('event')
2222
.expect(envelope => {
23+
// Transaction item (first item in envelope)
2324
const transactionEvent = envelope[1]?.[0]?.[1] as any;
24-
2525
expect(transactionEvent.transaction).toBe('GET /');
26-
expect(transactionEvent.spans).toEqual([]);
27-
})
28-
.expect(envelope => {
29-
const container = envelope[1]?.[0]?.[1] as any;
26+
27+
// Span container item (second item in same envelope)
28+
const container = envelope[1]?.[1]?.[1] as any;
29+
expect(container).toBeDefined();
3030
const spans = container.items;
3131

3232
const chatSpan = spans.find(

dev-packages/cloudflare-integration-tests/suites/tracing/google-genai/test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ it('traces Google GenAI chat creation and message sending', async () => {
2121
const runner = createRunner(__dirname)
2222
.ignore('event')
2323
.expect(envelope => {
24+
// Transaction item (first item in envelope)
2425
const transactionEvent = envelope[1]?.[0]?.[1] as any;
25-
2626
expect(transactionEvent.transaction).toBe('GET /');
27-
expect(transactionEvent.spans).toEqual([]);
28-
})
29-
.expect(envelope => {
30-
const container = envelope[1]?.[0]?.[1] as any;
27+
28+
// Span container item (second item in same envelope)
29+
const container = envelope[1]?.[1]?.[1] as any;
30+
expect(container).toBeDefined();
3131
const spans = container.items;
3232

3333
// chat.sendMessage

dev-packages/cloudflare-integration-tests/suites/tracing/langchain/test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ it('traces langchain chat model, chain, and tool invocations', async ({ signal }
2121
const runner = createRunner(__dirname)
2222
.ignore('event')
2323
.expect(envelope => {
24+
// Transaction item (first item in envelope)
2425
const transactionEvent = envelope[1]?.[0]?.[1] as any;
25-
2626
expect(transactionEvent.transaction).toBe('GET /');
27-
expect(transactionEvent.spans).toEqual([]);
28-
})
29-
.expect(envelope => {
30-
const container = envelope[1]?.[0]?.[1] as any;
27+
28+
// Span container item (second item in same envelope)
29+
const container = envelope[1]?.[1]?.[1] as any;
30+
expect(container).toBeDefined();
3131
const spans = container.items;
3232

3333
// Chat model span

dev-packages/cloudflare-integration-tests/suites/tracing/langgraph/test.ts

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,17 @@ it('traces langgraph compile and invoke operations', async ({ signal }) => {
2121
const runner = createRunner(__dirname)
2222
.ignore('event')
2323
.expect(envelope => {
24+
// Transaction item (first item in envelope)
2425
const transactionEvent = envelope[1]?.[0]?.[1] as any;
25-
2626
expect(transactionEvent.transaction).toBe('GET /');
27-
expect(transactionEvent.spans).toEqual([]);
28-
})
29-
.expect(envelope => {
30-
const container = envelope[1]?.[0]?.[1] as any;
27+
28+
// Span container item (second item in same envelope)
29+
const container = envelope[1]?.[1]?.[1] as any;
30+
expect(container).toBeDefined();
3131
const spans = container.items;
3232

3333
// Check create_agent span
34-
const createAgentSpan = spans.find(
35-
(s: any) => s.attributes?.['sentry.op']?.value === 'gen_ai.create_agent',
36-
);
34+
const createAgentSpan = spans.find((s: any) => s.attributes?.['sentry.op']?.value === 'gen_ai.create_agent');
3735
expect(createAgentSpan).toBeDefined();
3836
expect(createAgentSpan).toMatchObject({
3937
name: 'create_agent weather_assistant',
@@ -47,9 +45,7 @@ it('traces langgraph compile and invoke operations', async ({ signal }) => {
4745
});
4846

4947
// Check invoke_agent span
50-
const invokeAgentSpan = spans.find(
51-
(s: any) => s.attributes?.['sentry.op']?.value === 'gen_ai.invoke_agent',
52-
);
48+
const invokeAgentSpan = spans.find((s: any) => s.attributes?.['sentry.op']?.value === 'gen_ai.invoke_agent');
5349
expect(invokeAgentSpan).toBeDefined();
5450
expect(invokeAgentSpan).toMatchObject({
5551
name: 'invoke_agent weather_assistant',

dev-packages/cloudflare-integration-tests/suites/tracing/openai/test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ it('traces a basic chat completion request', async ({ signal }) => {
2222
const runner = createRunner(__dirname)
2323
.ignore('event')
2424
.expect(envelope => {
25-
const transactionEvent = envelope[1]?.[0]?.[1];
26-
25+
// Transaction item (first item in envelope)
26+
const transactionEvent = envelope[1]?.[0]?.[1] as any;
2727
expect(transactionEvent.transaction).toBe('GET /');
28-
expect(transactionEvent.spans).toEqual([]);
29-
})
30-
.expect(envelope => {
31-
const container = envelope[1]?.[0]?.[1] as any;
28+
29+
// Span container item (second item in same envelope)
30+
const container = envelope[1]?.[1]?.[1] as any;
31+
expect(container).toBeDefined();
3232
const spans = container.items;
3333

3434
const chatSpan = spans.find(

0 commit comments

Comments
 (0)