mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-12 13:30:49 +00:00
test: tighten helper assertion guards
This commit is contained in:
@@ -944,7 +944,10 @@ export function describeTtsSummarizationContract() {
|
||||
`Invalid targetLength: ${testCase.targetLength}`,
|
||||
);
|
||||
} else {
|
||||
await expect(call, String(testCase.targetLength)).resolves.toBeDefined();
|
||||
await expect(call, String(testCase.targetLength)).resolves.toMatchObject({
|
||||
summary: expect.any(String),
|
||||
inputLength: 4,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1159,8 +1162,10 @@ export function describeTtsProviderRuntimeContract() {
|
||||
if (result.success) {
|
||||
throw new Error("expected synthesis failure");
|
||||
}
|
||||
expect(result.error).toBeDefined();
|
||||
const errorMessage = result.error ?? "";
|
||||
const errorMessage = result.error;
|
||||
if (typeof errorMessage !== "string") {
|
||||
throw new Error("expected synthesis failure error message");
|
||||
}
|
||||
expect(errorMessage).toBe("TTS conversion failed: openai: provider failed");
|
||||
expect(errorMessage).not.toContain("TTS conversion failed: TTS conversion failed:");
|
||||
expect(errorMessage.match(/TTS conversion failed:/g)).toHaveLength(1);
|
||||
@@ -1259,7 +1264,9 @@ export function describeTtsAutoApplyContract() {
|
||||
if (params.expectSamePayload) {
|
||||
expect(result).toBe(params.payload);
|
||||
} else {
|
||||
expect(result.mediaUrl).toBeDefined();
|
||||
if (typeof result.mediaUrl !== "string" || result.mediaUrl.length === 0) {
|
||||
throw new Error("expected auto TTS to attach mediaUrl");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user