Skip to content

Commit 81db86a

Browse files
dancergr2m
authored andcommitted
refactor(provider/anthropic): finish fixture migration for doGenerate tests (#12511)
## background anthropic tests were partially migrated to the fixture-based pattern - doStream and some doGenerate tests already used `prepareJsonFixtureResponse` / `prepareChunksFixtureResponse`, but 3 `prepareJsonResponse` helper definitions (55 total calls) still remained ## summary - record `anthropic-text.json` and `anthropic-text.chunks.txt` fixtures from real API (`claude-sonnet-4-5-20250929`) - replace 23 `prepareJsonResponse({})` calls (tests that only check request body/headers) with `prepareJsonFixtureResponse('anthropic-text')` - inline `server.urls` assignments for 10 main doGenerate tests that need specific response content (reasoning, usage, citations, tool calls, etc.) - inline `server.urls` assignments for 8 web search tests and delete the scoped helper - inline `server.urls` assignments for 4 code execution tests and delete the scoped helper - remove the main `prepareJsonResponse` function definition and unused `Citation`/`JSONObject` imports
1 parent 6875474 commit 81db86a

3 files changed

Lines changed: 462 additions & 401 deletions

File tree

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01QC4g3HwBThD4BaNtBckFDJ","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":12,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard","inference_geo":"not_available"}}}
2+
{"type":"content_block_start","index":0,"content_block":{"type":"text","text":""}}
3+
{"type":"ping"}
4+
{"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Hello"}}
5+
{"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"! I"}}
6+
{"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"'m doing well, thank you for asking"}}
7+
{"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":". How are you doing today?"}}
8+
{"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Is"}}
9+
{"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" there anything I can help you with?"}}
10+
{"type":"content_block_stop","index":0}
11+
{"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":12,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":30}}
12+
{"type":"message_stop"}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"model": "claude-sonnet-4-5-20250929",
3+
"id": "msg_01VdEjxAP5ahtHKrrRdNBteQ",
4+
"type": "message",
5+
"role": "assistant",
6+
"content": [
7+
{
8+
"type": "text",
9+
"text": "Hello! I'm doing well, thanks for asking. How are you doing today? Is there anything I can help you with?"
10+
}
11+
],
12+
"stop_reason": "end_turn",
13+
"stop_sequence": null,
14+
"usage": {
15+
"input_tokens": 12,
16+
"cache_creation_input_tokens": 0,
17+
"cache_read_input_tokens": 0,
18+
"cache_creation": {
19+
"ephemeral_5m_input_tokens": 0,
20+
"ephemeral_1h_input_tokens": 0
21+
},
22+
"output_tokens": 29,
23+
"service_tier": "standard",
24+
"inference_geo": "not_available"
25+
}
26+
}

0 commit comments

Comments
 (0)