test(llm): show malformed Files payloads in case names

Interpolating an empty body directly produces empty parentheses in the failure title, making the empty-response case harder to distinguish from the truncated JSON case in CI logs.

Use JSON formatting for the existing case object so the operation and body are visible, including an explicit empty string. Keep the same inputs, error classification, original-cause assertions, and single-request checks.
This commit is contained in:
Tianyi Cui committed 2026-09-19 21:19:46 +08:00
1 parent d4ff95c8e2
commit 3a0d640214
1 file changed
+1 -1
@@ -36,7 +36,7 @@ describe('DeepSeekFilesClient', () => {
describe.each(['messages', 'chat-completions'] as const)('%s successful response JSON', (protocol) => {
it.each((['upload', 'list', 'retrieve', 'delete'] as const).flatMap(operation =>
['', '{"id":'].map(body => ({ operation, body })),
))('rejects malformed $operation JSON with the operation and HTTP status ($body)', async ({ operation, body }) => {
))('rejects malformed JSON with operation and HTTP status: %j', async ({ operation, body }) => {
const fetchImpl = vi.fn<typeof fetch>(async () => new Response(body, { status: 200 }))
const client = new DeepSeekFilesClient({ protocol, baseURL: 'https://files.example', apiKey: 'test-key', fetch: fetchImpl })
const operations = {