
























@@ -944,10 +944,9 @@ export function describeTtsSummarizationContract() {
944944`Invalid targetLength: ${testCase.targetLength}`,
945945);
946946} else {
947-await expect(call, String(testCase.targetLength)).resolves.toMatchObject({
948-summary: expect.any(String),
949-inputLength: 4,
950-});
947+const result = await call;
948+expect(typeof result.summary, String(testCase.targetLength)).toBe("string");
949+expect(result.inputLength, String(testCase.targetLength)).toBe(4);
951950}
952951});
953952@@ -1046,16 +1045,22 @@ export function describeTtsProviderRuntimeContract() {
10461045expect(result.provider).toBe("microsoft");
10471046expect(result.fallbackFrom).toBe("openai");
10481047expect(result.attemptedProviders).toEqual(["openai", "microsoft"]);
1049-expect(result.attempts?.[0]).toMatchObject({
1050-provider: "openai",
1051-outcome: "failed",
1052-reasonCode: "provider_error",
1053-});
1054-expect(result.attempts?.[1]).toMatchObject({
1055-provider: "microsoft",
1056-outcome: "success",
1057-reasonCode: "success",
1058-});
1048+expect(result.attempts).toHaveLength(2);
1049+expect(result.attempts?.[0]?.provider).toBe("openai");
1050+expect(result.attempts?.[0]?.outcome).toBe("failed");
1051+expect(result.attempts?.[0]?.reasonCode).toBe("provider_error");
1052+expect(result.attempts?.[0]?.persona).toBeUndefined();
1053+expect(result.attempts?.[0]?.personaBinding).toBe("none");
1054+expect(typeof result.attempts?.[0]?.latencyMs).toBe("number");
1055+expect(result.attempts?.[0]?.error).toContain("openai: Authorization: Bearer");
1056+expect(result.attempts?.[0]?.error).not.toContain("sk-readiness-throw-token-1234567890");
1057+expect(result.attempts?.[1]?.provider).toBe("microsoft");
1058+expect(result.attempts?.[1]?.outcome).toBe("success");
1059+expect(result.attempts?.[1]?.reasonCode).toBe("success");
1060+expect(result.attempts?.[1]?.persona).toBeUndefined();
1061+expect(result.attempts?.[1]?.personaBinding).toBe("none");
1062+expect(typeof result.attempts?.[1]?.latencyMs).toBe("number");
1063+expect(result.attempts?.[1]?.error).toBeUndefined();
10591064});
10601065});
10611066@@ -1116,16 +1121,22 @@ export function describeTtsProviderRuntimeContract() {
11161121expect(result.provider).toBe("microsoft");
11171122expect(result.fallbackFrom).toBe("primary-throws");
11181123expect(result.attemptedProviders).toEqual(["primary-throws", "microsoft"]);
1119-expect(result.attempts?.[0]).toMatchObject({
1120-provider: "primary-throws",
1121-outcome: "failed",
1122-reasonCode: "provider_error",
1123-});
1124-expect(result.attempts?.[1]).toMatchObject({
1125-provider: "microsoft",
1126-outcome: "success",
1127-reasonCode: "success",
1128-});
1124+expect(result.attempts).toHaveLength(2);
1125+expect(result.attempts?.[0]?.provider).toBe("primary-throws");
1126+expect(result.attempts?.[0]?.outcome).toBe("failed");
1127+expect(result.attempts?.[0]?.reasonCode).toBe("provider_error");
1128+expect(result.attempts?.[0]?.persona).toBeUndefined();
1129+expect(result.attempts?.[0]?.personaBinding).toBe("none");
1130+expect(typeof result.attempts?.[0]?.latencyMs).toBe("number");
1131+expect(result.attempts?.[0]?.error).toContain("primary-throws: Authorization: Bearer");
1132+expect(result.attempts?.[0]?.error).not.toContain("sk-telephony-throw-token-1234567890");
1133+expect(result.attempts?.[1]?.provider).toBe("microsoft");
1134+expect(result.attempts?.[1]?.outcome).toBe("success");
1135+expect(result.attempts?.[1]?.reasonCode).toBe("success");
1136+expect(result.attempts?.[1]?.persona).toBeUndefined();
1137+expect(result.attempts?.[1]?.personaBinding).toBe("none");
1138+expect(typeof result.attempts?.[1]?.latencyMs).toBe("number");
1139+expect(result.attempts?.[1]?.error).toBeUndefined();
11291140});
11301141});
11311142此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。