mirror of https://github.com/openclaw/openclaw.git
test: drop redundant web search registration smokes
This commit is contained in:
parent
49ac85b56d
commit
73ead2425b
|
|
@ -26,24 +26,6 @@ describe("duckduckgo web search provider", () => {
|
|||
runDuckDuckGoSearch.mockImplementation(async (params: Record<string, unknown>) => params);
|
||||
});
|
||||
|
||||
it("registers a keyless web search provider", () => {
|
||||
const webSearchProviders: unknown[] = [];
|
||||
|
||||
plugin.register({
|
||||
registerWebSearchProvider(provider: unknown) {
|
||||
webSearchProviders.push(provider);
|
||||
},
|
||||
} as never);
|
||||
|
||||
expect(plugin.id).toBe("duckduckgo");
|
||||
expect(webSearchProviders).toHaveLength(1);
|
||||
|
||||
const provider = webSearchProviders[0] as Record<string, unknown>;
|
||||
expect(provider.id).toBe("duckduckgo");
|
||||
expect(provider.requiresCredential).toBe(false);
|
||||
expect(provider.envVars).toEqual([]);
|
||||
});
|
||||
|
||||
it("exposes keyless metadata and enables the plugin in config", () => {
|
||||
const provider = createDuckDuckGoWebSearchProvider();
|
||||
if (!provider.applySelectionConfig) {
|
||||
|
|
|
|||
|
|
@ -3,28 +3,6 @@ import plugin from "../index.js";
|
|||
import { __testing, createExaWebSearchProvider } from "./exa-web-search-provider.js";
|
||||
|
||||
describe("exa web search provider", () => {
|
||||
it("registers the web search provider", () => {
|
||||
const registrations: { webSearchProviders: unknown[] } = { webSearchProviders: [] };
|
||||
|
||||
const mockApi = {
|
||||
registerWebSearchProvider(provider: unknown) {
|
||||
registrations.webSearchProviders.push(provider);
|
||||
},
|
||||
config: {},
|
||||
};
|
||||
|
||||
plugin.register(mockApi as never);
|
||||
|
||||
expect(plugin.id).toBe("exa");
|
||||
expect(plugin.name).toBe("Exa Plugin");
|
||||
expect(registrations.webSearchProviders).toHaveLength(1);
|
||||
|
||||
const provider = registrations.webSearchProviders[0] as Record<string, unknown>;
|
||||
expect(provider.id).toBe("exa");
|
||||
expect(provider.autoDetectOrder).toBe(65);
|
||||
expect(provider.envVars).toEqual(["EXA_API_KEY"]);
|
||||
});
|
||||
|
||||
it("exposes the expected metadata and selection wiring", () => {
|
||||
const provider = createExaWebSearchProvider();
|
||||
if (!provider.applySelectionConfig) {
|
||||
|
|
|
|||
|
|
@ -64,39 +64,6 @@ describe("tavily tools", () => {
|
|||
expect(applied.plugins?.entries?.tavily?.enabled).toBe(true);
|
||||
});
|
||||
|
||||
it("registers web search provider and two tools", () => {
|
||||
const registrations: {
|
||||
webSearchProviders: unknown[];
|
||||
tools: unknown[];
|
||||
} = { webSearchProviders: [], tools: [] };
|
||||
|
||||
const mockApi = {
|
||||
registerWebSearchProvider(provider: unknown) {
|
||||
registrations.webSearchProviders.push(provider);
|
||||
},
|
||||
registerTool(tool: unknown) {
|
||||
registrations.tools.push(tool);
|
||||
},
|
||||
config: {},
|
||||
};
|
||||
|
||||
plugin.register(mockApi as never);
|
||||
|
||||
expect(plugin.id).toBe("tavily");
|
||||
expect(plugin.name).toBe("Tavily Plugin");
|
||||
expect(registrations.webSearchProviders).toHaveLength(1);
|
||||
expect(registrations.tools).toHaveLength(2);
|
||||
|
||||
const provider = registrations.webSearchProviders[0] as Record<string, unknown>;
|
||||
expect(provider.id).toBe("tavily");
|
||||
expect(provider.autoDetectOrder).toBe(70);
|
||||
expect(provider.envVars).toEqual(["TAVILY_API_KEY"]);
|
||||
|
||||
const toolNames = registrations.tools.map((t) => (t as Record<string, unknown>).name);
|
||||
expect(toolNames).toContain("tavily_search");
|
||||
expect(toolNames).toContain("tavily_extract");
|
||||
});
|
||||
|
||||
it("maps generic provider args into Tavily search params", async () => {
|
||||
const provider = createTavilyWebSearchProvider();
|
||||
const tool = provider.createTool({
|
||||
|
|
|
|||
Loading…
Reference in New Issue