test: add provider HTTP live coverage · openclaw/openclaw@def392a
steipete
·
2026-04-25
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -6,6 +6,7 @@ import {
|
6 | 6 | } from "../../test/helpers/plugins/provider-registration.js"; |
7 | 7 | import { normalizeTranscriptForMatch } from "../../test/helpers/stt-live-audio.js"; |
8 | 8 | import plugin from "./index.js"; |
| 9 | +import { createGeminiWebSearchProvider } from "./src/gemini-web-search-provider.js"; |
9 | 10 | |
10 | 11 | const GOOGLE_API_KEY = |
11 | 12 | process.env.GEMINI_API_KEY?.trim() || process.env.GOOGLE_API_KEY?.trim() || ""; |
@@ -63,4 +64,19 @@ describeLive("google plugin live", () => {
|
63 | 64 | expect(normalized).toContain("google"); |
64 | 65 | expect(normalized).toContain("openclaw"); |
65 | 66 | }, 180_000); |
| 67 | + |
| 68 | +it("runs Gemini web search through the registered provider tool", async () => { |
| 69 | +const provider = createGeminiWebSearchProvider(); |
| 70 | +const tool = provider.createTool?.({ |
| 71 | +config: {}, |
| 72 | +searchConfig: { gemini: { apiKey: GOOGLE_API_KEY }, cacheTtlMinutes: 0 }, |
| 73 | +} as never); |
| 74 | + |
| 75 | +const result = await tool?.execute({ query: "OpenClaw GitHub", count: 1 }); |
| 76 | + |
| 77 | +expect(result?.provider).toBe("gemini"); |
| 78 | +expect(typeof result?.content).toBe("string"); |
| 79 | +expect((result?.content as string).length).toBeGreaterThan(20); |
| 80 | +expect(Array.isArray(result?.citations)).toBe(true); |
| 81 | +}, 120_000); |
66 | 82 | }); |
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +import { describe, expect, it } from "vitest"; |
| 2 | +import { isLiveTestEnabled } from "../../src/agents/live-test-helpers.js"; |
| 3 | +import { listMicrosoftVoices } from "./speech-provider.js"; |
| 4 | + |
| 5 | +const describeLive = isLiveTestEnabled() ? describe : describe.skip; |
| 6 | + |
| 7 | +describeLive("microsoft plugin live", () => { |
| 8 | +it("lists Edge speech voices", async () => { |
| 9 | +const voices = await listMicrosoftVoices(); |
| 10 | + |
| 11 | +expect(voices.length).toBeGreaterThan(100); |
| 12 | +expect(voices.some((voice) => voice.id === "en-US-MichelleNeural")).toBe(true); |
| 13 | +}, 60_000); |
| 14 | +}); |
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +import { describe, expect, it } from "vitest"; |
| 2 | +import { isLiveTestEnabled } from "../../src/agents/live-test-helpers.js"; |
| 3 | +import { createMiniMaxWebSearchProvider } from "./src/minimax-web-search-provider.js"; |
| 4 | + |
| 5 | +const MINIMAX_SEARCH_KEY = |
| 6 | +process.env.MINIMAX_CODE_PLAN_KEY?.trim() || |
| 7 | +process.env.MINIMAX_CODING_API_KEY?.trim() || |
| 8 | +process.env.MINIMAX_API_KEY?.trim() || |
| 9 | +""; |
| 10 | +const describeLive = |
| 11 | +isLiveTestEnabled() && MINIMAX_SEARCH_KEY.length > 0 ? describe : describe.skip; |
| 12 | + |
| 13 | +describeLive("minimax plugin live", () => { |
| 14 | +it("runs MiniMax web search through the provider tool", async () => { |
| 15 | +const provider = createMiniMaxWebSearchProvider(); |
| 16 | +const tool = provider.createTool?.({ |
| 17 | +config: {}, |
| 18 | +searchConfig: { apiKey: MINIMAX_SEARCH_KEY, cacheTtlMinutes: 0 }, |
| 19 | +} as never); |
| 20 | + |
| 21 | +const result = await tool?.execute({ query: "OpenClaw GitHub", count: 1 }); |
| 22 | + |
| 23 | +expect(result?.provider).toBe("minimax"); |
| 24 | +expect(result?.count).toBeGreaterThan(0); |
| 25 | +expect(Array.isArray(result?.results)).toBe(true); |
| 26 | +}, 120_000); |
| 27 | +}); |
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +import { describe, expect, it } from "vitest"; |
| 2 | +import { isLiveTestEnabled } from "../../src/agents/live-test-helpers.js"; |
| 3 | +import { createKimiWebSearchProvider } from "./src/kimi-web-search-provider.js"; |
| 4 | + |
| 5 | +const KIMI_SEARCH_KEY = |
| 6 | +process.env.KIMI_API_KEY?.trim() || process.env.MOONSHOT_API_KEY?.trim() || ""; |
| 7 | +const describeLive = isLiveTestEnabled() && KIMI_SEARCH_KEY.length > 0 ? describe : describe.skip; |
| 8 | + |
| 9 | +describeLive("moonshot plugin live", () => { |
| 10 | +it("runs Kimi web search through the provider tool", async () => { |
| 11 | +const provider = createKimiWebSearchProvider(); |
| 12 | +const tool = provider.createTool?.({ |
| 13 | +config: {}, |
| 14 | +searchConfig: { kimi: { apiKey: KIMI_SEARCH_KEY }, cacheTtlMinutes: 0 }, |
| 15 | +} as never); |
| 16 | + |
| 17 | +const result = await tool?.execute({ query: "OpenClaw GitHub", count: 1 }); |
| 18 | + |
| 19 | +expect(result?.provider).toBe("kimi"); |
| 20 | +expect(typeof result?.content).toBe("string"); |
| 21 | +expect((result?.content as string).length).toBeGreaterThan(20); |
| 22 | +expect(Array.isArray(result?.citations)).toBe(true); |
| 23 | +}, 120_000); |
| 24 | +}); |
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。