Commit 0b19e76
refactor(provider/openai): migrate all tests to fixture pattern (#12514)
## background
openai provider tests used inline `prepareJsonResponse` /
`prepareStreamResponse` helpers that constructed fake API responses.
this made tests fragile and inconsistent with the fixture-based pattern
used by other migrated providers
## summary
- record real API fixtures for all 6 openai test files (chat, responses,
completion, embedding, transcription, image)
- replace all `prepareJsonResponse` / `prepareStreamResponse` helpers
with `prepareJsonFixtureResponse` / `prepareChunksFixtureResponse` that
read from `__fixtures__/` files
- inline `server.urls` for tests that check specific response content
(finish reasons, logprobs, usage overrides, etc.)
- trim large response data per conventions (embedding vectors to 5
values, image base64 to ~100 chars, transcription words to 5)
- fix missing `.filter(line => line.trim().length > 0)` in chat
`prepareChunksFixtureResponse` to match reference pattern
- zero `prepareJsonResponse` or `prepareStreamResponse` remaining in the
openai package1 parent 81db86a commit 0b19e76
15 files changed
Lines changed: 1855 additions & 1198 deletions
File tree
- packages/openai/src
- chat
- __fixtures__
- completion
- __fixtures__
- embedding
- __fixtures__
- __snapshots__
- image
- __fixtures__
- responses
- transcription
- __fixtures__
Lines changed: 303 additions & 0 deletions
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
0 commit comments