mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 05:40:44 +00:00
test: add provider HTTP live coverage
This commit is contained in:
@@ -6,6 +6,7 @@ import {
|
||||
} from "../../test/helpers/plugins/provider-registration.js";
|
||||
import { normalizeTranscriptForMatch } from "../../test/helpers/stt-live-audio.js";
|
||||
import plugin from "./index.js";
|
||||
import { createGeminiWebSearchProvider } from "./src/gemini-web-search-provider.js";
|
||||
|
||||
const GOOGLE_API_KEY =
|
||||
process.env.GEMINI_API_KEY?.trim() || process.env.GOOGLE_API_KEY?.trim() || "";
|
||||
@@ -63,4 +64,19 @@ describeLive("google plugin live", () => {
|
||||
expect(normalized).toContain("google");
|
||||
expect(normalized).toContain("openclaw");
|
||||
}, 180_000);
|
||||
|
||||
it("runs Gemini web search through the registered provider tool", async () => {
|
||||
const provider = createGeminiWebSearchProvider();
|
||||
const tool = provider.createTool?.({
|
||||
config: {},
|
||||
searchConfig: { gemini: { apiKey: GOOGLE_API_KEY }, cacheTtlMinutes: 0 },
|
||||
} as never);
|
||||
|
||||
const result = await tool?.execute({ query: "OpenClaw GitHub", count: 1 });
|
||||
|
||||
expect(result?.provider).toBe("gemini");
|
||||
expect(typeof result?.content).toBe("string");
|
||||
expect((result?.content as string).length).toBeGreaterThan(20);
|
||||
expect(Array.isArray(result?.citations)).toBe(true);
|
||||
}, 120_000);
|
||||
});
|
||||
|
||||
14
extensions/microsoft/microsoft.live.test.ts
Normal file
14
extensions/microsoft/microsoft.live.test.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { isLiveTestEnabled } from "../../src/agents/live-test-helpers.js";
|
||||
import { listMicrosoftVoices } from "./speech-provider.js";
|
||||
|
||||
const describeLive = isLiveTestEnabled() ? describe : describe.skip;
|
||||
|
||||
describeLive("microsoft plugin live", () => {
|
||||
it("lists Edge speech voices", async () => {
|
||||
const voices = await listMicrosoftVoices();
|
||||
|
||||
expect(voices.length).toBeGreaterThan(100);
|
||||
expect(voices.some((voice) => voice.id === "en-US-MichelleNeural")).toBe(true);
|
||||
}, 60_000);
|
||||
});
|
||||
27
extensions/minimax/minimax.live.test.ts
Normal file
27
extensions/minimax/minimax.live.test.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { isLiveTestEnabled } from "../../src/agents/live-test-helpers.js";
|
||||
import { createMiniMaxWebSearchProvider } from "./src/minimax-web-search-provider.js";
|
||||
|
||||
const MINIMAX_SEARCH_KEY =
|
||||
process.env.MINIMAX_CODE_PLAN_KEY?.trim() ||
|
||||
process.env.MINIMAX_CODING_API_KEY?.trim() ||
|
||||
process.env.MINIMAX_API_KEY?.trim() ||
|
||||
"";
|
||||
const describeLive =
|
||||
isLiveTestEnabled() && MINIMAX_SEARCH_KEY.length > 0 ? describe : describe.skip;
|
||||
|
||||
describeLive("minimax plugin live", () => {
|
||||
it("runs MiniMax web search through the provider tool", async () => {
|
||||
const provider = createMiniMaxWebSearchProvider();
|
||||
const tool = provider.createTool?.({
|
||||
config: {},
|
||||
searchConfig: { apiKey: MINIMAX_SEARCH_KEY, cacheTtlMinutes: 0 },
|
||||
} as never);
|
||||
|
||||
const result = await tool?.execute({ query: "OpenClaw GitHub", count: 1 });
|
||||
|
||||
expect(result?.provider).toBe("minimax");
|
||||
expect(result?.count).toBeGreaterThan(0);
|
||||
expect(Array.isArray(result?.results)).toBe(true);
|
||||
}, 120_000);
|
||||
});
|
||||
24
extensions/moonshot/moonshot.live.test.ts
Normal file
24
extensions/moonshot/moonshot.live.test.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { isLiveTestEnabled } from "../../src/agents/live-test-helpers.js";
|
||||
import { createKimiWebSearchProvider } from "./src/kimi-web-search-provider.js";
|
||||
|
||||
const KIMI_SEARCH_KEY =
|
||||
process.env.KIMI_API_KEY?.trim() || process.env.MOONSHOT_API_KEY?.trim() || "";
|
||||
const describeLive = isLiveTestEnabled() && KIMI_SEARCH_KEY.length > 0 ? describe : describe.skip;
|
||||
|
||||
describeLive("moonshot plugin live", () => {
|
||||
it("runs Kimi web search through the provider tool", async () => {
|
||||
const provider = createKimiWebSearchProvider();
|
||||
const tool = provider.createTool?.({
|
||||
config: {},
|
||||
searchConfig: { kimi: { apiKey: KIMI_SEARCH_KEY }, cacheTtlMinutes: 0 },
|
||||
} as never);
|
||||
|
||||
const result = await tool?.execute({ query: "OpenClaw GitHub", count: 1 });
|
||||
|
||||
expect(result?.provider).toBe("kimi");
|
||||
expect(typeof result?.content).toBe("string");
|
||||
expect((result?.content as string).length).toBeGreaterThan(20);
|
||||
expect(Array.isArray(result?.citations)).toBe(true);
|
||||
}, 120_000);
|
||||
});
|
||||
Reference in New Issue
Block a user