mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-17 04:50:51 +00:00
test: fix stale web search and boot-md contracts
This commit is contained in:
@@ -5,12 +5,17 @@ import type { OpenClawConfig } from "../../../config/config.js";
|
||||
|
||||
const runBootOnce = vi.fn();
|
||||
|
||||
vi.mock("../../../gateway/boot.js", () => ({ runBootOnce }));
|
||||
vi.mock("../../../logging/subsystem.js", () => ({
|
||||
createSubsystemLogger: () => ({
|
||||
function createMockLogger() {
|
||||
return {
|
||||
warn: vi.fn(),
|
||||
debug: vi.fn(),
|
||||
}),
|
||||
child: vi.fn(() => createMockLogger()),
|
||||
};
|
||||
}
|
||||
|
||||
vi.mock("../../../gateway/boot.js", () => ({ runBootOnce }));
|
||||
vi.mock("../../../logging/subsystem.js", () => ({
|
||||
createSubsystemLogger: () => createMockLogger(),
|
||||
}));
|
||||
|
||||
const { default: runBootChecklist } = await import("./handler.js");
|
||||
|
||||
@@ -10,16 +10,21 @@ const logDebug = vi.fn();
|
||||
const MAIN_WORKSPACE_DIR = path.join(path.sep, "ws", "main");
|
||||
const OPS_WORKSPACE_DIR = path.join(path.sep, "ws", "ops");
|
||||
|
||||
function createMockLogger() {
|
||||
return {
|
||||
warn: logWarn,
|
||||
debug: logDebug,
|
||||
child: vi.fn(() => createMockLogger()),
|
||||
};
|
||||
}
|
||||
|
||||
vi.mock("../../../gateway/boot.js", () => ({ runBootOnce }));
|
||||
vi.mock("../../../agents/agent-scope.js", () => ({
|
||||
listAgentIds,
|
||||
resolveAgentWorkspaceDir,
|
||||
}));
|
||||
vi.mock("../../../logging/subsystem.js", () => ({
|
||||
createSubsystemLogger: () => ({
|
||||
warn: logWarn,
|
||||
debug: logDebug,
|
||||
}),
|
||||
createSubsystemLogger: () => createMockLogger(),
|
||||
}));
|
||||
|
||||
const { default: runBootChecklist } = await import("./handler.js");
|
||||
|
||||
@@ -75,15 +75,12 @@ describe("plugin loader contract", () => {
|
||||
webSearchProviderContractRegistry.map((entry) => entry.pluginId),
|
||||
);
|
||||
|
||||
resolvePluginWebSearchProviders({});
|
||||
const providers = resolvePluginWebSearchProviders({});
|
||||
|
||||
expect(loadOpenClawPluginsMock).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
onlyPluginIds: webSearchPluginIds,
|
||||
activate: false,
|
||||
cache: false,
|
||||
}),
|
||||
expect(uniqueSortedPluginIds(providers.map((provider) => provider.pluginId))).toEqual(
|
||||
webSearchPluginIds,
|
||||
);
|
||||
expect(loadOpenClawPluginsMock).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("keeps bundled web search allowlist compatibility wired to the web search registry", () => {
|
||||
@@ -91,7 +88,7 @@ describe("plugin loader contract", () => {
|
||||
webSearchProviderContractRegistry.map((entry) => entry.pluginId),
|
||||
);
|
||||
|
||||
resolvePluginWebSearchProviders({
|
||||
const providers = resolvePluginWebSearchProviders({
|
||||
bundledAllowlistCompat: true,
|
||||
config: {
|
||||
plugins: {
|
||||
@@ -100,15 +97,9 @@ describe("plugin loader contract", () => {
|
||||
},
|
||||
});
|
||||
|
||||
expect(loadOpenClawPluginsMock).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
config: expect.objectContaining({
|
||||
plugins: expect.objectContaining({
|
||||
allow: expect.arrayContaining(webSearchPluginIds),
|
||||
}),
|
||||
}),
|
||||
onlyPluginIds: webSearchPluginIds,
|
||||
}),
|
||||
expect(uniqueSortedPluginIds(providers.map((provider) => provider.pluginId))).toEqual(
|
||||
webSearchPluginIds,
|
||||
);
|
||||
expect(loadOpenClawPluginsMock).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user