test: repair latest-main web search regressions

This commit is contained in:
Peter Steinberger 2026-03-20 20:16:44 +00:00
parent 23fef04c4e
commit fa71ad7c5d
3 changed files with 22 additions and 1 deletions

View File

@ -195,6 +195,7 @@ function scanWebSearchRegistrySmells(sourceFile, filePath) {
function shouldSkipFile(filePath) {
const relativeFile = normalizePath(filePath);
return (
relativeFile === "src/plugins/bundled-web-search-registry.ts" ||
relativeFile.startsWith("src/plugins/contracts/") ||
/^src\/plugins\/runtime\/runtime-[^/]+-contract\.[cm]?[jt]s$/u.test(relativeFile)
);

View File

@ -49,6 +49,23 @@ const listConfiguredWebSearchProviders = vi.hoisted(() =>
vi.fn<(params?: { config?: OpenClawConfig }) => PluginWebSearchProviderEntry[]>(() => []),
);
function createWebSearchProviderEntry(
entry: Omit<
PluginWebSearchProviderEntry,
"pluginId" | "getCredentialValue" | "setCredentialValue" | "createTool"
> & {
pluginId?: string;
},
): PluginWebSearchProviderEntry {
return {
...entry,
pluginId: entry.pluginId ?? entry.id,
getCredentialValue: () => undefined,
setCredentialValue: () => {},
createTool: () => null,
};
}
vi.mock("../commands/onboard-helpers.js", () => ({
detectBrowserOpenSupport: vi.fn(async () => ({ ok: false })),
formatControlUiSshHint: vi.fn(() => "ssh hint"),

View File

@ -21,12 +21,15 @@ function readBaseline() {
}
describe("plugin extension import boundary inventory", () => {
it("keeps web-search-providers out of the remaining inventory", async () => {
it("keeps dedicated web-search registry shims out of the remaining inventory", async () => {
const inventory = await collectPluginExtensionImportBoundaryInventory();
expect(inventory.some((entry) => entry.file === "src/plugins/web-search-providers.ts")).toBe(
false,
);
expect(
inventory.some((entry) => entry.file === "src/plugins/bundled-web-search-registry.ts"),
).toBe(false);
});
it("ignores boundary shims by scope", async () => {