Files
openclaw/extensions/voice-call/src/voice-mapping.test.ts
Peter Steinberger 7bf80dc2c6 chore(tooling): enforce formatting and refresh TypeScript checks (#104239)
* chore(tooling): enforce current formatter and refresh checks

* chore(tooling): keep release changelog formatter-owned

* chore(tooling): retain compatible Node type surface

* ci: enforce formatting for docs-only changes

* ci: isolate docs formatter check

* chore(tooling): apply updated lint and format rules

* chore(tooling): satisfy updated switch lint

* style(ui): apply Linux formatter layout

* test(doctor): match quiet local audio contribution

* test(doctor): assert quiet output only

* test(doctor): follow restored information contract
2026-07-11 01:09:51 -07:00

21 lines
928 B
TypeScript

// Voice Call tests cover voice mapping plugin behavior.
import { describe, expect, it } from "vitest";
import { DEFAULT_POLLY_VOICE, escapeXml, mapVoiceToPolly } from "./voice-mapping.js";
describe("voice mapping", () => {
it("escapes xml-special characters", () => {
expect(escapeXml(`5 < 6 & "quote" 'apostrophe' > 4`)).toBe(
"5 &lt; 6 &amp; &quot;quote&quot; &apos;apostrophe&apos; &gt; 4",
);
});
it("maps openai voices, passes through provider voices, and falls back to default", () => {
expect(mapVoiceToPolly("alloy")).toBe("Polly.Joanna");
expect(mapVoiceToPolly("ECHO")).toBe("Polly.Matthew");
expect(mapVoiceToPolly("Polly.Brian")).toBe("Polly.Brian");
expect(mapVoiceToPolly("Google.en-US-Standard-C")).toBe("Google.en-US-Standard-C");
expect(mapVoiceToPolly("unknown")).toBe(DEFAULT_POLLY_VOICE);
expect(mapVoiceToPolly(undefined)).toBe(DEFAULT_POLLY_VOICE);
});
});