





















@@ -65,4 +65,77 @@ describe("plugins Docker assertions", () => {
6565rmSync(root, { force: true, recursive: true });
6666}
6767});
68+69+it("compares local plugin source paths by canonical path", () => {
70+const root = mkdtempSync(path.join(tmpdir(), "openclaw-plugins-assertions-"));
71+const home = path.join(root, "home");
72+const scratchRoot = path.join(root, "scratch");
73+const sourceParent = path.join(root, "source");
74+const sourcePath = `${sourceParent}//plugin`;
75+const normalizedSourcePath = path.join(sourceParent, "plugin");
76+const installPath = path.join(home, ".openclaw", "extensions", "demo-plugin-dir");
77+mkdirSync(sourcePath, { recursive: true });
78+mkdirSync(installPath, { recursive: true });
79+80+try {
81+writeJson(path.join(scratchRoot, "plugins3.json"), {
82+plugins: [{ id: "demo-plugin-dir", status: "loaded" }],
83+});
84+writeJson(path.join(scratchRoot, "plugins3-inspect.json"), {
85+gatewayMethods: ["demo.dir"],
86+});
87+writeJson(path.join(home, ".openclaw", "plugins", "installs.json"), {
88+installRecords: {
89+"demo-plugin-dir": {
90+source: "path",
91+sourcePath: normalizedSourcePath,
92+ installPath,
93+},
94+},
95+});
96+97+const result = spawnSync(process.execPath, [ASSERTIONS_SCRIPT, "plugin-dir", sourcePath], {
98+encoding: "utf8",
99+env: {
100+ ...process.env,
101+HOME: home,
102+OPENCLAW_PLUGINS_TMP_DIR: scratchRoot,
103+},
104+});
105+106+expect(result.status).toBe(0);
107+} finally {
108+rmSync(root, { force: true, recursive: true });
109+}
110+});
111+112+it("still requires archive managed install directories to be removed", () => {
113+const root = mkdtempSync(path.join(tmpdir(), "openclaw-plugins-assertions-"));
114+const home = path.join(root, "home");
115+const scratchRoot = path.join(root, "scratch");
116+const installPath = path.join(home, ".openclaw", "extensions", "demo-plugin-tgz");
117+mkdirSync(installPath, { recursive: true });
118+119+try {
120+writeJson(path.join(scratchRoot, "plugins2-uninstalled.json"), { plugins: [] });
121+writeFileSync(path.join(scratchRoot, "plugins2-install-path.txt"), installPath, "utf8");
122+writeJson(path.join(home, ".openclaw", "plugins", "installs.json"), {
123+installRecords: {},
124+});
125+126+const result = spawnSync(process.execPath, [ASSERTIONS_SCRIPT, "plugin-tgz-removed"], {
127+encoding: "utf8",
128+env: {
129+ ...process.env,
130+HOME: home,
131+OPENCLAW_PLUGINS_TMP_DIR: scratchRoot,
132+},
133+});
134+135+expect(result.status).not.toBe(0);
136+expect(result.stderr).toContain("managed install path still exists after uninstall");
137+} finally {
138+rmSync(root, { force: true, recursive: true });
139+}
140+});
68141});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。