mirror of
https://github.com/moltbot/moltbot.git
synced 2026-05-13 23:56:07 +00:00
test: tighten provider live assertions
This commit is contained in:
@@ -36,9 +36,7 @@ describeLive("azure speech plugin live", () => {
|
||||
});
|
||||
|
||||
expect(voices?.length).toBeGreaterThan(100);
|
||||
expect(voices).toEqual(
|
||||
expect.arrayContaining([expect.objectContaining({ id: "en-US-JennyNeural" })]),
|
||||
);
|
||||
expect(voices?.some((voice) => voice.id === "en-US-JennyNeural")).toBe(true);
|
||||
}, 120_000);
|
||||
|
||||
it("synthesizes MP3, native Ogg/Opus voice notes, and telephony audio", async () => {
|
||||
|
||||
@@ -161,20 +161,17 @@ describeLive("deepseek plugin live", () => {
|
||||
|
||||
const messages = capturedPayload?.messages;
|
||||
expect(Array.isArray(messages)).toBe(true);
|
||||
expect((messages as Array<Record<string, unknown>>)[1]).toMatchObject({
|
||||
role: "assistant",
|
||||
reasoning_content: "",
|
||||
tool_calls: [
|
||||
{
|
||||
id: toolCallId,
|
||||
type: "function",
|
||||
function: {
|
||||
name: "noop",
|
||||
arguments: "{}",
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
const assistantMessage = (messages as Array<Record<string, unknown>>)[1];
|
||||
expect(assistantMessage?.role).toBe("assistant");
|
||||
expect(assistantMessage?.reasoning_content).toBe("");
|
||||
const toolCalls = assistantMessage?.tool_calls;
|
||||
expect(Array.isArray(toolCalls)).toBe(true);
|
||||
const toolCall = (toolCalls as Array<Record<string, unknown>>)[0];
|
||||
expect(toolCall?.id).toBe(toolCallId);
|
||||
expect(toolCall?.type).toBe("function");
|
||||
const toolFunction = toolCall?.function as Record<string, unknown> | undefined;
|
||||
expect(toolFunction?.name).toBe("noop");
|
||||
expect(toolFunction?.arguments).toBe("{}");
|
||||
expect(extractNonEmptyAssistantText(result.content).length).toBeGreaterThan(0);
|
||||
}, 60_000);
|
||||
|
||||
@@ -226,11 +223,10 @@ describeLive("deepseek plugin live", () => {
|
||||
|
||||
const messages = capturedPayload?.messages;
|
||||
expect(Array.isArray(messages)).toBe(true);
|
||||
expect((messages as Array<Record<string, unknown>>)[1]).toMatchObject({
|
||||
role: "assistant",
|
||||
content: "Hello.",
|
||||
reasoning_content: "",
|
||||
});
|
||||
const assistantMessage = (messages as Array<Record<string, unknown>>)[1];
|
||||
expect(assistantMessage?.role).toBe("assistant");
|
||||
expect(assistantMessage?.content).toBe("Hello.");
|
||||
expect(assistantMessage?.reasoning_content).toBe("");
|
||||
expect(extractNonEmptyAssistantText(result.content).length).toBeGreaterThan(0);
|
||||
}, 60_000);
|
||||
});
|
||||
|
||||
@@ -27,7 +27,7 @@ describeLive("inworld plugin live", () => {
|
||||
});
|
||||
|
||||
expect(voices?.length).toBeGreaterThan(0);
|
||||
expect(voices).toEqual(expect.arrayContaining([expect.objectContaining({ id: "Sarah" })]));
|
||||
expect(voices?.some((voice) => voice.id === "Sarah")).toBe(true);
|
||||
}, 120_000);
|
||||
|
||||
it("synthesizes MP3, native voice-note Ogg/Opus, and telephony PCM", async () => {
|
||||
|
||||
@@ -142,12 +142,10 @@ describe.skipIf(!LIVE)("ollama live", () => {
|
||||
model?: string;
|
||||
outputs?: Array<{ text?: string }>;
|
||||
};
|
||||
expect(payload).toMatchObject({
|
||||
ok: true,
|
||||
transport: "local",
|
||||
provider: "ollama",
|
||||
model: CHAT_MODEL,
|
||||
});
|
||||
expect(payload.ok).toBe(true);
|
||||
expect(payload.transport).toBe("local");
|
||||
expect(payload.provider).toBe("ollama");
|
||||
expect(payload.model).toBe(CHAT_MODEL);
|
||||
expect(payload.outputs?.[0]?.text?.trim().length ?? 0).toBeGreaterThan(0);
|
||||
});
|
||||
}, 120_000);
|
||||
|
||||
@@ -169,13 +169,11 @@ describeLive("buildOpenAIProvider live", () => {
|
||||
model: resolved,
|
||||
});
|
||||
|
||||
expect(normalized).toMatchObject({
|
||||
provider: "openai",
|
||||
id: liveCase.modelId,
|
||||
api: "openai-responses",
|
||||
baseUrl: "https://api.openai.com/v1",
|
||||
reasoning: liveCase.reasoning,
|
||||
});
|
||||
expect(normalized?.provider).toBe("openai");
|
||||
expect(normalized?.id).toBe(liveCase.modelId);
|
||||
expect(normalized?.api).toBe("openai-responses");
|
||||
expect(normalized?.baseUrl).toBe("https://api.openai.com/v1");
|
||||
expect(normalized?.reasoning).toEqual(liveCase.reasoning);
|
||||
|
||||
const client = new OpenAI({
|
||||
apiKey: OPENAI_API_KEY,
|
||||
|
||||
@@ -11,7 +11,7 @@ describeLive("openai tts live", () => {
|
||||
const speechProvider = buildOpenAISpeechProvider();
|
||||
|
||||
const voices = await speechProvider.listVoices?.({});
|
||||
expect(voices).toEqual(expect.arrayContaining([expect.objectContaining({ id: "alloy" })]));
|
||||
expect(voices?.some((voice) => voice.id === "alloy")).toBe(true);
|
||||
|
||||
const providerConfig = {
|
||||
apiKey: OPENAI_API_KEY,
|
||||
|
||||
@@ -234,12 +234,10 @@ describeLive("openai plugin live", () => {
|
||||
model: resolved,
|
||||
});
|
||||
|
||||
expect(normalized).toMatchObject({
|
||||
provider: "openai",
|
||||
id: LIVE_MODEL_ID,
|
||||
api: "openai-responses",
|
||||
baseUrl: "https://api.openai.com/v1",
|
||||
});
|
||||
expect(normalized?.provider).toBe("openai");
|
||||
expect(normalized?.id).toBe(LIVE_MODEL_ID);
|
||||
expect(normalized?.api).toBe("openai-responses");
|
||||
expect(normalized?.baseUrl).toBe("https://api.openai.com/v1");
|
||||
|
||||
const client = new OpenAI({
|
||||
apiKey: OPENAI_API_KEY,
|
||||
@@ -265,7 +263,7 @@ describeLive("openai plugin live", () => {
|
||||
if (!voices) {
|
||||
throw new Error("openai speech provider did not return voices");
|
||||
}
|
||||
expect(voices).toEqual(expect.arrayContaining([expect.objectContaining({ id: "alloy" })]));
|
||||
expect(voices.some((voice) => voice.id === "alloy")).toBe(true);
|
||||
|
||||
const cfg = createLiveConfig();
|
||||
const ttsConfig = createLiveTtsConfig();
|
||||
|
||||
@@ -63,12 +63,10 @@ describeLive("openrouter plugin live", () => {
|
||||
throw new Error(`openrouter provider did not resolve ${LIVE_MODEL_ID}`);
|
||||
}
|
||||
|
||||
expect(resolved).toMatchObject({
|
||||
provider: "openrouter",
|
||||
id: LIVE_MODEL_ID,
|
||||
api: "openai-completions",
|
||||
baseUrl: "https://openrouter.ai/api/v1",
|
||||
});
|
||||
expect(resolved.provider).toBe("openrouter");
|
||||
expect(resolved.id).toBe(LIVE_MODEL_ID);
|
||||
expect(resolved.api).toBe("openai-completions");
|
||||
expect(resolved.baseUrl).toBe("https://openrouter.ai/api/v1");
|
||||
|
||||
const client = new OpenAI({
|
||||
apiKey: OPENROUTER_API_KEY,
|
||||
|
||||
@@ -60,9 +60,7 @@ describe.skipIf(!LIVE || !VYDRA_API_KEY)("vydra live", () => {
|
||||
const { speechProviders } = await registerVydraPlugin();
|
||||
const provider = requireRegisteredProvider(speechProviders, "vydra");
|
||||
const voices = await provider.listVoices?.({});
|
||||
expect(voices).toEqual(
|
||||
expect.arrayContaining([expect.objectContaining({ id: "21m00Tcm4TlvDq8ikWAM" })]),
|
||||
);
|
||||
expect(voices?.some((voice) => voice.id === "21m00Tcm4TlvDq8ikWAM")).toBe(true);
|
||||
|
||||
const result = await provider.synthesize({
|
||||
text: "OpenClaw integration test OK.",
|
||||
|
||||
Reference in New Issue
Block a user