From a3827a93a934c6757a98600fc1b0e1c8fbb83e18 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Mon, 20 Apr 2026 19:24:02 +0100 Subject: [PATCH] test: share doctor bundled plugin fixture --- ...doctor-bundled-plugin-runtime-deps.test.ts | 44 ++++++------------- 1 file changed, 14 insertions(+), 30 deletions(-) diff --git a/src/commands/doctor-bundled-plugin-runtime-deps.test.ts b/src/commands/doctor-bundled-plugin-runtime-deps.test.ts index d7d906751c0..72ebf7cd974 100644 --- a/src/commands/doctor-bundled-plugin-runtime-deps.test.ts +++ b/src/commands/doctor-bundled-plugin-runtime-deps.test.ts @@ -9,6 +9,17 @@ function writeJson(filePath: string, value: unknown) { fs.writeFileSync(filePath, `${JSON.stringify(value, null, 2)}\n`, "utf8"); } +function writeBundledChannelPlugin(root: string, id: string, dependencies: Record) { + writeJson(path.join(root, "dist", "extensions", id, "package.json"), { + dependencies, + }); + writeJson(path.join(root, "dist", "extensions", id, "openclaw.plugin.json"), { + id, + channels: [id], + configSchema: { type: "object" }, + }); +} + describe("doctor bundled plugin runtime deps", () => { it("skips source checkouts", () => { const root = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-doctor-bundled-")); @@ -69,26 +80,8 @@ describe("doctor bundled plugin runtime deps", () => { const root = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-doctor-bundled-")); writeJson(path.join(root, "package.json"), { name: "openclaw" }); - writeJson(path.join(root, "dist", "extensions", "discord", "package.json"), { - dependencies: { - "discord-only": "1.0.0", - }, - }); - writeJson(path.join(root, "dist", "extensions", "discord", "openclaw.plugin.json"), { - id: "discord", - channels: ["discord"], - configSchema: { type: "object" }, - }); - writeJson(path.join(root, "dist", "extensions", "whatsapp", "package.json"), { - dependencies: { - "whatsapp-only": "1.0.0", - }, - }); - writeJson(path.join(root, "dist", "extensions", "whatsapp", "openclaw.plugin.json"), { - id: "whatsapp", - channels: ["whatsapp"], - configSchema: { type: "object" }, - }); + writeBundledChannelPlugin(root, "discord", { "discord-only": "1.0.0" }); + writeBundledChannelPlugin(root, "whatsapp", { "whatsapp-only": "1.0.0" }); const result = scanBundledPluginRuntimeDeps({ packageRoot: root, @@ -109,16 +102,7 @@ describe("doctor bundled plugin runtime deps", () => { it("does not report bundled channel deps when the channel is not enabled", () => { const root = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-doctor-bundled-")); writeJson(path.join(root, "package.json"), { name: "openclaw" }); - writeJson(path.join(root, "dist", "extensions", "discord", "package.json"), { - dependencies: { - "discord-only": "1.0.0", - }, - }); - writeJson(path.join(root, "dist", "extensions", "discord", "openclaw.plugin.json"), { - id: "discord", - channels: ["discord"], - configSchema: { type: "object" }, - }); + writeBundledChannelPlugin(root, "discord", { "discord-only": "1.0.0" }); const result = scanBundledPluginRuntimeDeps({ packageRoot: root,