test: tighten live matcher assertions · openclaw/openclaw@fb890e7
steipete
·
2026-05-10
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -127,10 +127,9 @@ describeLive("anthropic transport stream live", () => {
|
127 | 127 | ? await Promise.race([requestBodyPromise, delay(500, requestBody)]) |
128 | 128 | : requestBody; |
129 | 129 | if (capturedRequestBody.trim().length > 0) { |
130 | | -expect(JSON.parse(capturedRequestBody)).toMatchObject({ |
131 | | -model: "claude-sonnet-4-6", |
132 | | -stream: true, |
133 | | -}); |
| 130 | +const body = JSON.parse(capturedRequestBody) as { model?: unknown; stream?: unknown }; |
| 131 | +expect(body.model).toBe("claude-sonnet-4-6"); |
| 132 | +expect(body.stream).toBe(true); |
134 | 133 | } |
135 | 134 | } finally { |
136 | 135 | if (!controller.signal.aborted) { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -90,12 +90,10 @@ describe.skipIf(!LIVE)("image tool Ollama live", () => {
|
90 | 90 | image: imagePath, |
91 | 91 | }); |
92 | 92 | |
93 | | -expect(result).toMatchObject({ |
94 | | -content: [expect.objectContaining({ type: "text" })], |
95 | | -}); |
96 | | -const text = ( |
97 | | -result as { content?: Array<{ type?: string; text?: string }> } |
98 | | -).content?.[0]?.text?.trim(); |
| 93 | +const content = (result as { content?: Array<{ type?: string; text?: string }> }).content; |
| 94 | +expect(Array.isArray(content)).toBe(true); |
| 95 | +expect(content?.[0]?.type).toBe("text"); |
| 96 | +const text = content?.[0]?.text?.trim(); |
99 | 97 | expect(text?.length ?? 0).toBeGreaterThan(0); |
100 | 98 | }); |
101 | 99 | }, 180_000); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。