test: tighten mistral media and onboarding coverage

This commit is contained in:
Peter Steinberger
2026-02-23 00:18:49 +00:00
parent 8a8faf066e
commit 60c494c024
5 changed files with 153 additions and 36 deletions

View File

@@ -109,47 +109,69 @@ describe("runCapability auto audio entries", () => {
});
it("uses mistral when only mistral key is configured", async () => {
const priorEnv: Record<string, string | undefined> = {
OPENAI_API_KEY: process.env.OPENAI_API_KEY,
GROQ_API_KEY: process.env.GROQ_API_KEY,
DEEPGRAM_API_KEY: process.env.DEEPGRAM_API_KEY,
GEMINI_API_KEY: process.env.GEMINI_API_KEY,
MISTRAL_API_KEY: process.env.MISTRAL_API_KEY,
};
delete process.env.OPENAI_API_KEY;
delete process.env.GROQ_API_KEY;
delete process.env.DEEPGRAM_API_KEY;
delete process.env.GEMINI_API_KEY;
process.env.MISTRAL_API_KEY = "mistral-test-key";
let runResult: Awaited<ReturnType<typeof runCapability>> | undefined;
await withAudioFixture("openclaw-auto-audio-mistral", async ({ ctx, media, cache }) => {
const providerRegistry = buildProviderRegistry({
openai: {
id: "openai",
capabilities: ["audio"],
transcribeAudio: async () => ({ text: "openai", model: "gpt-4o-mini-transcribe" }),
},
mistral: {
id: "mistral",
capabilities: ["audio"],
transcribeAudio: async (req) => ({ text: "mistral", model: req.model ?? "unknown" }),
},
});
const cfg = {
models: {
providers: {
mistral: {
apiKey: "mistral-test-key",
models: [],
try {
await withAudioFixture("openclaw-auto-audio-mistral", async ({ ctx, media, cache }) => {
const providerRegistry = buildProviderRegistry({
openai: {
id: "openai",
capabilities: ["audio"],
transcribeAudio: async () => ({ text: "openai", model: "gpt-4o-mini-transcribe" }),
},
mistral: {
id: "mistral",
capabilities: ["audio"],
transcribeAudio: async (req) => ({ text: "mistral", model: req.model ?? "unknown" }),
},
});
const cfg = {
models: {
providers: {
mistral: {
apiKey: "mistral-test-key",
models: [],
},
},
},
},
tools: {
media: {
audio: {
enabled: true,
tools: {
media: {
audio: {
enabled: true,
},
},
},
},
} as unknown as OpenClawConfig;
} as unknown as OpenClawConfig;
runResult = await runCapability({
capability: "audio",
cfg,
ctx,
attachments: cache,
media,
providerRegistry,
runResult = await runCapability({
capability: "audio",
cfg,
ctx,
attachments: cache,
media,
providerRegistry,
});
});
});
} finally {
for (const [key, value] of Object.entries(priorEnv)) {
if (value === undefined) {
delete process.env[key];
} else {
process.env[key] = value;
}
}
}
if (!runResult) {
throw new Error("Expected auto audio mistral result");
}