test: repair latest-main web search regressions
This commit is contained in:
parent
23fef04c4e
commit
fa71ad7c5d
@ -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)
|
||||
);
|
||||
|
||||
@ -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"),
|
||||
|
||||
@ -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 () => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user