mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-19 05:44:46 +00:00
test: assert tts contract attempts
This commit is contained in:
@@ -944,10 +944,9 @@ export function describeTtsSummarizationContract() {
|
||||
`Invalid targetLength: ${testCase.targetLength}`,
|
||||
);
|
||||
} else {
|
||||
await expect(call, String(testCase.targetLength)).resolves.toMatchObject({
|
||||
summary: expect.any(String),
|
||||
inputLength: 4,
|
||||
});
|
||||
const result = await call;
|
||||
expect(typeof result.summary, String(testCase.targetLength)).toBe("string");
|
||||
expect(result.inputLength, String(testCase.targetLength)).toBe(4);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1046,16 +1045,22 @@ export function describeTtsProviderRuntimeContract() {
|
||||
expect(result.provider).toBe("microsoft");
|
||||
expect(result.fallbackFrom).toBe("openai");
|
||||
expect(result.attemptedProviders).toEqual(["openai", "microsoft"]);
|
||||
expect(result.attempts?.[0]).toMatchObject({
|
||||
provider: "openai",
|
||||
outcome: "failed",
|
||||
reasonCode: "provider_error",
|
||||
});
|
||||
expect(result.attempts?.[1]).toMatchObject({
|
||||
provider: "microsoft",
|
||||
outcome: "success",
|
||||
reasonCode: "success",
|
||||
});
|
||||
expect(result.attempts).toHaveLength(2);
|
||||
expect(result.attempts?.[0]?.provider).toBe("openai");
|
||||
expect(result.attempts?.[0]?.outcome).toBe("failed");
|
||||
expect(result.attempts?.[0]?.reasonCode).toBe("provider_error");
|
||||
expect(result.attempts?.[0]?.persona).toBeUndefined();
|
||||
expect(result.attempts?.[0]?.personaBinding).toBe("none");
|
||||
expect(typeof result.attempts?.[0]?.latencyMs).toBe("number");
|
||||
expect(result.attempts?.[0]?.error).toContain("openai: Authorization: Bearer");
|
||||
expect(result.attempts?.[0]?.error).not.toContain("sk-readiness-throw-token-1234567890");
|
||||
expect(result.attempts?.[1]?.provider).toBe("microsoft");
|
||||
expect(result.attempts?.[1]?.outcome).toBe("success");
|
||||
expect(result.attempts?.[1]?.reasonCode).toBe("success");
|
||||
expect(result.attempts?.[1]?.persona).toBeUndefined();
|
||||
expect(result.attempts?.[1]?.personaBinding).toBe("none");
|
||||
expect(typeof result.attempts?.[1]?.latencyMs).toBe("number");
|
||||
expect(result.attempts?.[1]?.error).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1116,16 +1121,22 @@ export function describeTtsProviderRuntimeContract() {
|
||||
expect(result.provider).toBe("microsoft");
|
||||
expect(result.fallbackFrom).toBe("primary-throws");
|
||||
expect(result.attemptedProviders).toEqual(["primary-throws", "microsoft"]);
|
||||
expect(result.attempts?.[0]).toMatchObject({
|
||||
provider: "primary-throws",
|
||||
outcome: "failed",
|
||||
reasonCode: "provider_error",
|
||||
});
|
||||
expect(result.attempts?.[1]).toMatchObject({
|
||||
provider: "microsoft",
|
||||
outcome: "success",
|
||||
reasonCode: "success",
|
||||
});
|
||||
expect(result.attempts).toHaveLength(2);
|
||||
expect(result.attempts?.[0]?.provider).toBe("primary-throws");
|
||||
expect(result.attempts?.[0]?.outcome).toBe("failed");
|
||||
expect(result.attempts?.[0]?.reasonCode).toBe("provider_error");
|
||||
expect(result.attempts?.[0]?.persona).toBeUndefined();
|
||||
expect(result.attempts?.[0]?.personaBinding).toBe("none");
|
||||
expect(typeof result.attempts?.[0]?.latencyMs).toBe("number");
|
||||
expect(result.attempts?.[0]?.error).toContain("primary-throws: Authorization: Bearer");
|
||||
expect(result.attempts?.[0]?.error).not.toContain("sk-telephony-throw-token-1234567890");
|
||||
expect(result.attempts?.[1]?.provider).toBe("microsoft");
|
||||
expect(result.attempts?.[1]?.outcome).toBe("success");
|
||||
expect(result.attempts?.[1]?.reasonCode).toBe("success");
|
||||
expect(result.attempts?.[1]?.persona).toBeUndefined();
|
||||
expect(result.attempts?.[1]?.personaBinding).toBe("none");
|
||||
expect(typeof result.attempts?.[1]?.latencyMs).toBe("number");
|
||||
expect(result.attempts?.[1]?.error).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user