import { beforeEach, describe, expect, it, vi } from "vitest"; import { bundledPluginRootAt, repoInstallSpec } from "../../test/helpers/bundled-plugin-paths.js"; import type { OpenClawConfig } from "../config/config.js"; import type { ConfigFileSnapshot } from "../config/types.openclaw.js"; import {
resolvePluginInstallRequestContext,
type PluginInstallRequestContext,
} from "./plugin-install-config-policy.js"; import { loadConfigForInstall } from "./plugins-install-command.js";
it("returns the config directly when loadConfig succeeds", async () => { const cfg = { plugins: { entries: { matrix: { enabled: true } } } } as OpenClawConfig;
loadConfigMock.mockReturnValue(cfg);
const result = await loadConfigForInstall(matrixNpmRequest);
expect(result).toBe(cfg);
expect(readConfigFileSnapshotMock).not.toHaveBeenCalled();
});
it("does not run stale Matrix cleanup on the happy path", async () => { const cfg = { plugins: {} } as OpenClawConfig;
loadConfigMock.mockReturnValue(cfg);
const result = await loadConfigForInstall(matrixNpmRequest);
expect(collectChannelDoctorStaleConfigMutationsMock).not.toHaveBeenCalled();
expect(result).toBe(cfg);
});
it("falls back to snapshot config for explicit bundled-plugin reinstall when issues match the known upgrade failure", async () => { const invalidConfigErr = new Error("config invalid");
(invalidConfigErr as { code?: string }).code = "INVALID_CONFIG";
loadConfigMock.mockImplementation(() => { throw invalidConfigErr;
});
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.12Bemerkung:
(vorverarbeitet am 2026-06-09)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.