openclaw/src/config/zod-schema.tts.test.ts
ademczuk 8618a711ff
fix(voice-call): add speed and instructions to OpenAI TTS config schema (#39226)
Merged via squash.

Prepared head SHA: 775e3063b58d4629f59021798ab1c7222ff069d9
Co-authored-by: ademczuk <5212682+ademczuk@users.noreply.github.com>
Co-authored-by: obviyus <22031114+obviyus@users.noreply.github.com>
Reviewed-by: @obviyus
2026-03-11 23:15:48 +05:30

37 lines
817 B
TypeScript

import { describe, expect, it } from "vitest";
import { TtsConfigSchema } from "./zod-schema.core.js";
describe("TtsConfigSchema openai speed and instructions", () => {
it("accepts speed and instructions in openai section", () => {
expect(() =>
TtsConfigSchema.parse({
openai: {
voice: "alloy",
speed: 1.5,
instructions: "Speak in a cheerful tone",
},
}),
).not.toThrow();
});
it("rejects out-of-range openai speed", () => {
expect(() =>
TtsConfigSchema.parse({
openai: {
speed: 5.0,
},
}),
).toThrow();
});
it("rejects openai speed below minimum", () => {
expect(() =>
TtsConfigSchema.parse({
openai: {
speed: 0.1,
},
}),
).toThrow();
});
});