From f5812aa64d48ec10035ac7e4052b0577baf02bbd Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sun, 26 Apr 2026 03:19:14 +0100 Subject: [PATCH] test: complete plugin install manifest fixtures --- .../channel-setup/plugin-install.test.ts | 36 ++++++++++++++++--- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/src/commands/channel-setup/plugin-install.test.ts b/src/commands/channel-setup/plugin-install.test.ts index 409bcc3341d..ebee8943ff4 100644 --- a/src/commands/channel-setup/plugin-install.test.ts +++ b/src/commands/channel-setup/plugin-install.test.ts @@ -159,20 +159,41 @@ function makeSkipInstallPrompter() { return { prompter, select }; } +function makeManifestRecord(plugin: { + id: string; + channels?: string[]; + origin?: "bundled" | "global" | "workspace"; + activation?: { onChannels?: string[] }; +}) { + const rootDir = `/tmp/openclaw-plugins/${plugin.id}`; + return { + id: plugin.id, + origin: plugin.origin ?? "bundled", + channels: plugin.channels ?? [], + providers: [], + cliBackends: [], + hooks: [], + skills: [], + rootDir, + source: path.join(rootDir, "index.js"), + manifestPath: path.join(rootDir, "openclaw.plugin.json"), + ...(plugin.activation ? { activation: plugin.activation } : {}), + }; +} + function mockActivationOnlyPlugin(plugin: { id: string; origin?: "bundled" | "global" | "workspace"; }) { loadPluginManifestRegistry.mockReturnValue({ plugins: [ - { + makeManifestRecord({ id: plugin.id, - channels: [], - ...(plugin.origin === undefined ? {} : { origin: plugin.origin }), + origin: plugin.origin, activation: { onChannels: ["external-chat"], }, - }, + }), ], diagnostics: [], }); @@ -746,7 +767,12 @@ describe("ensureChannelSetupPluginInstalled", () => { const runtime = makeRuntime(); const cfg: OpenClawConfig = {}; loadPluginManifestRegistry.mockReturnValue({ - plugins: [{ id: "custom-external-chat-plugin", channels: ["external-chat"] }], + plugins: [ + makeManifestRecord({ + id: "custom-external-chat-plugin", + channels: ["external-chat"], + }), + ], diagnostics: [], });