mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 12:10:44 +00:00
test: require provider optional hooks
This commit is contained in:
@@ -349,7 +349,10 @@ describe("buildMinimaxSpeechProvider", () => {
|
||||
expect(mockFetch).toHaveBeenCalledOnce();
|
||||
const [url, init] = mockFetch.mock.calls[0];
|
||||
expect(url).toBe("https://api.minimaxi.com/v1/t2a_v2");
|
||||
const body = JSON.parse(init!.body as string);
|
||||
if (!init?.body) {
|
||||
throw new Error("Expected MiniMax TTS fetch init body");
|
||||
}
|
||||
const body = JSON.parse(init.body as string);
|
||||
expect(body.model).toBe("speech-2.8-hd");
|
||||
expect(body.text).toBe("Hello world");
|
||||
expect(body.voice_setting.voice_id).toBe("English_expressive_narrator");
|
||||
@@ -505,7 +508,11 @@ describe("buildMinimaxSpeechProvider", () => {
|
||||
|
||||
describe("listVoices", () => {
|
||||
it("returns known voices", async () => {
|
||||
const voices = await provider.listVoices!({} as never);
|
||||
const listVoices = provider.listVoices;
|
||||
if (!listVoices) {
|
||||
throw new Error("Expected MiniMax provider listVoices");
|
||||
}
|
||||
const voices = await listVoices({} as never);
|
||||
expect(voices.length).toBeGreaterThan(0);
|
||||
expect(voices[0].id).toBe("English_expressive_narrator");
|
||||
});
|
||||
|
||||
@@ -155,8 +155,12 @@ describe("searxng web search provider", () => {
|
||||
it("persists base URL to plugin config via setConfiguredCredentialValue", () => {
|
||||
const provider = createSearxngWebSearchProvider();
|
||||
const config = {} as Record<string, unknown>;
|
||||
const setConfiguredCredentialValue = provider.setConfiguredCredentialValue;
|
||||
if (!setConfiguredCredentialValue) {
|
||||
throw new Error("Expected SearXNG provider setConfiguredCredentialValue");
|
||||
}
|
||||
|
||||
provider.setConfiguredCredentialValue!(config, "http://search.local:9000");
|
||||
setConfiguredCredentialValue(config, "http://search.local:9000");
|
||||
|
||||
expect(
|
||||
(
|
||||
|
||||
@@ -108,7 +108,11 @@ describe("Volcengine speech provider", () => {
|
||||
});
|
||||
|
||||
it("lists voices with locale and gender", async () => {
|
||||
const voices = await provider.listVoices!({});
|
||||
const listVoices = provider.listVoices;
|
||||
if (!listVoices) {
|
||||
throw new Error("Expected Volcengine provider listVoices");
|
||||
}
|
||||
const voices = await listVoices({});
|
||||
expect(voices.length).toBeGreaterThan(0);
|
||||
expect(voices[0]).toMatchObject({ locale: "en-US" });
|
||||
expect(voices[0].gender).toMatch(/^(female|male)$/u);
|
||||
|
||||
Reference in New Issue
Block a user