test: guard tts contract mock calls · openclaw/openclaw@7411396
steipete
·
2026-05-12
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -900,7 +900,7 @@ export function describeTtsSummarizationContract() {
|
900 | 900 | it("calls the summary model with the expected parameters", async () => { |
901 | 901 | await runSummarizeText(); |
902 | 902 | |
903 | | -const callArgs = vi.mocked(completeSimple).mock.calls[0]; |
| 903 | +const callArgs = vi.mocked(completeSimple).mock.calls.at(0); |
904 | 904 | expect(callArgs?.[1]?.messages?.[0]?.role).toBe("user"); |
905 | 905 | expect(callArgs?.[2]?.maxTokens).toBe(250); |
906 | 906 | expect(callArgs?.[2]?.temperature).toBe(0.3); |
@@ -928,7 +928,7 @@ export function describeTtsSummarizationContract() {
|
928 | 928 | |
929 | 929 | await runSummarizeText(); |
930 | 930 | |
931 | | -expect(vi.mocked(completeSimple).mock.calls[0]?.[0]?.api).toBe("openai-completions"); |
| 931 | +expect(vi.mocked(completeSimple).mock.calls.at(0)?.[0]?.api).toBe("openai-completions"); |
932 | 932 | expect(ensureCustomApiRegisteredMock).not.toHaveBeenCalled(); |
933 | 933 | }); |
934 | 934 | |
@@ -1196,7 +1196,7 @@ export function describeTtsProviderRuntimeContract() {
|
1196 | 1196 | |
1197 | 1197 | expect(result.success).toBe(true); |
1198 | 1198 | expect(fetchMock).toHaveBeenCalledTimes(1); |
1199 | | -const [, init] = fetchMock.mock.calls[0] as [string, RequestInit]; |
| 1199 | +const [, init] = fetchMock.mock.calls.at(0) as [string, RequestInit]; |
1200 | 1200 | expect(typeof init.body).toBe("string"); |
1201 | 1201 | const body = JSON.parse(init.body as string) as Record<string, unknown>; |
1202 | 1202 | expect(body.instructions).toBe(expectedInstructions); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。