Skip to content

Commit 772f568

Browse files
committed
fix(tests): properly wrap all message arrays with conversion functions
Update E2E tests to use fromChatMessages() and fromClaudeMessages() wrappers for all message array inputs. This fixes CI validation failures by ensuring all tests explicitly convert message formats before passing to callModel(). Changes: - Add imports for fromChatMessages and fromClaudeMessages - Use Python script to automatically wrap input: [...] patterns with fromChatMessages([...]) - Manually wrap Claude message variables with fromClaudeMessages() - All ~40 test cases now properly use conversion functions This ensures tests demonstrate the correct SDK usage pattern and pass validation.
1 parent a26646f commit 772f568

File tree

1 file changed

+30
-30
lines changed

1 file changed

+30
-30
lines changed

tests/e2e/call-model.test.ts

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ describe('callModel E2E Tests', () => {
431431
role: 'user',
432432
content: 'Count from 1 to 5.',
433433
},
434-
],
434+
]),
435435
});
436436

437437
const deltas: string[] = [];
@@ -456,7 +456,7 @@ describe('callModel E2E Tests', () => {
456456
role: 'user',
457457
content: 'Write a short poem.',
458458
},
459-
],
459+
]),
460460
});
461461

462462
let firstDeltaTime: number | null = null;
@@ -491,7 +491,7 @@ describe('callModel E2E Tests', () => {
491491
role: 'user',
492492
content: "Say 'streaming test'.",
493493
},
494-
],
494+
]),
495495
});
496496

497497
const messages: (ResponsesOutputMessage | OpenResponsesFunctionCallOutput)[] = [];
@@ -532,7 +532,7 @@ describe('callModel E2E Tests', () => {
532532
role: 'user',
533533
content: "Say 'hello world'.",
534534
},
535-
],
535+
]),
536536
});
537537

538538
const messages: (ResponsesOutputMessage | OpenResponsesFunctionCallOutput)[] = [];
@@ -581,7 +581,7 @@ describe('callModel E2E Tests', () => {
581581
role: 'user',
582582
content: "What's the weather in Tokyo? Use the get_weather tool.",
583583
},
584-
],
584+
]),
585585
tools: [
586586
{
587587
type: ToolType.Function,
@@ -679,7 +679,7 @@ describe('callModel E2E Tests', () => {
679679
role: 'user',
680680
content: 'Count from 1 to 3.',
681681
},
682-
],
682+
]),
683683
});
684684

685685
for await (const message of response.getNewMessagesStream()) {
@@ -720,7 +720,7 @@ describe('callModel E2E Tests', () => {
720720
role: 'user',
721721
content: 'What is 2+2?',
722722
},
723-
],
723+
]),
724724
reasoning: {
725725
enabled: true,
726726
effort: 'low',
@@ -750,7 +750,7 @@ describe('callModel E2E Tests', () => {
750750
role: 'user',
751751
content: "What's the weather like in Paris? Use the get_weather tool to find out.",
752752
},
753-
],
753+
]),
754754
tools: [
755755
{
756756
type: ToolType.Function,
@@ -806,7 +806,7 @@ describe('callModel E2E Tests', () => {
806806
role: 'user',
807807
content: "Say 'hello'.",
808808
},
809-
],
809+
]),
810810
});
811811

812812
const events: EnhancedResponseStreamEvent[] = [];
@@ -838,7 +838,7 @@ describe('callModel E2E Tests', () => {
838838
role: 'user',
839839
content: 'Count to 3.',
840840
},
841-
],
841+
]),
842842
});
843843

844844
const textDeltaEvents: EnhancedResponseStreamEvent[] = [];
@@ -871,7 +871,7 @@ describe('callModel E2E Tests', () => {
871871
role: 'user',
872872
content: "Say 'test'.",
873873
},
874-
],
874+
]),
875875
});
876876

877877
const chunks: ChatStreamEvent[] = [];
@@ -897,7 +897,7 @@ describe('callModel E2E Tests', () => {
897897
role: 'user',
898898
content: 'Count from 1 to 3.',
899899
},
900-
],
900+
]),
901901
});
902902

903903
let hasContentDelta = false;
@@ -958,7 +958,7 @@ describe('callModel E2E Tests', () => {
958958
role: 'user',
959959
content: "Say 'hello world'.",
960960
},
961-
],
961+
]),
962962
});
963963

964964
const contentDeltas: ChatStreamEvent[] = [];
@@ -995,7 +995,7 @@ describe('callModel E2E Tests', () => {
995995
role: 'user',
996996
content: 'What time is it? Use the get_time tool.',
997997
},
998-
],
998+
]),
999999
tools: [
10001000
{
10011001
type: ToolType.Function,
@@ -1084,7 +1084,7 @@ describe('callModel E2E Tests', () => {
10841084
role: 'user',
10851085
content: "Say 'concurrent test'.",
10861086
},
1087-
],
1087+
]),
10881088
});
10891089

10901090
// Get full text and stream concurrently
@@ -1119,7 +1119,7 @@ describe('callModel E2E Tests', () => {
11191119
role: 'user',
11201120
content: 'Write a short sentence.',
11211121
},
1122-
],
1122+
]),
11231123
});
11241124

11251125
// Start two concurrent stream consumers
@@ -1167,7 +1167,7 @@ describe('callModel E2E Tests', () => {
11671167
role: 'user',
11681168
content: "Say 'sequential test'.",
11691169
},
1170-
],
1170+
]),
11711171
});
11721172

11731173
// First, get the full text
@@ -1197,7 +1197,7 @@ describe('callModel E2E Tests', () => {
11971197
role: 'user',
11981198
content: "Say 'reverse test'.",
11991199
},
1200-
],
1200+
]),
12011201
});
12021202

12031203
// First, collect deltas from stream
@@ -1228,7 +1228,7 @@ describe('callModel E2E Tests', () => {
12281228
role: 'user',
12291229
content: 'Test',
12301230
},
1231-
],
1231+
]),
12321232
});
12331233

12341234
await expect(response.getText()).rejects.toThrow();
@@ -1259,7 +1259,7 @@ describe('callModel E2E Tests', () => {
12591259
role: 'user',
12601260
content: "Say 'hello'.",
12611261
},
1262-
],
1262+
]),
12631263
});
12641264

12651265
const fullResponse = await response.getResponse();
@@ -1305,7 +1305,7 @@ describe('callModel E2E Tests', () => {
13051305
role: 'user',
13061306
content: "Say 'hello'.",
13071307
},
1308-
],
1308+
]),
13091309
});
13101310

13111311
const fullResponse = await response.getResponse();
@@ -1361,7 +1361,7 @@ describe('callModel E2E Tests', () => {
13611361
role: 'user',
13621362
content: "Say 'test'.",
13631363
},
1364-
],
1364+
]),
13651365
});
13661366

13671367
const fullResponse = await response.getResponse();
@@ -1387,7 +1387,7 @@ describe('callModel E2E Tests', () => {
13871387
role: 'user',
13881388
content: "Say 'test'.",
13891389
},
1390-
],
1390+
]),
13911391
});
13921392

13931393
// Get both text and full response concurrently
@@ -1415,7 +1415,7 @@ describe('callModel E2E Tests', () => {
14151415
role: 'user',
14161416
content: "Say 'consistent'.",
14171417
},
1418-
],
1418+
]),
14191419
});
14201420

14211421
const firstCall = await response.getResponse();
@@ -1440,7 +1440,7 @@ describe('callModel E2E Tests', () => {
14401440
role: 'user',
14411441
content: 'Write a long story about a cat.',
14421442
},
1443-
],
1443+
]),
14441444
maxOutputTokens: 10,
14451445
});
14461446

@@ -1459,7 +1459,7 @@ describe('callModel E2E Tests', () => {
14591459
role: 'user',
14601460
content: "Say exactly: 'test complete'",
14611461
},
1462-
],
1462+
]),
14631463
instructions: 'You are a helpful assistant. Keep responses concise.',
14641464
});
14651465

@@ -1479,7 +1479,7 @@ describe('callModel E2E Tests', () => {
14791479
role: 'user',
14801480
content: "Say 'provider test'.",
14811481
},
1482-
],
1482+
]),
14831483
provider: {
14841484
allowFallbacks: true,
14851485
requireParameters: false,
@@ -1501,7 +1501,7 @@ describe('callModel E2E Tests', () => {
15011501
role: 'user',
15021502
content: "Say 'ordered provider'.",
15031503
},
1504-
],
1504+
]),
15051505
provider: {
15061506
order: [
15071507
'Together',
@@ -1526,7 +1526,7 @@ describe('callModel E2E Tests', () => {
15261526
role: 'user',
15271527
content: "Say 'ignore test'.",
15281528
},
1529-
],
1529+
]),
15301530
provider: {
15311531
ignore: [
15321532
'SomeProvider',
@@ -1549,7 +1549,7 @@ describe('callModel E2E Tests', () => {
15491549
role: 'user',
15501550
content: "Say 'quantization test'.",
15511551
},
1552-
],
1552+
]),
15531553
provider: {
15541554
allowFallbacks: true,
15551555
},

0 commit comments

Comments
 (0)