fix: persist pending onboarding plugin installs

This commit is contained in:
Shakker
2026-04-26 02:33:07 +01:00
parent 2495585a32
commit 29463b9c47
6 changed files with 224 additions and 44 deletions

View File

@@ -23,7 +23,10 @@ vi.mock("../plugins/installed-plugin-index-records.js", async (importOriginal) =
};
});
import { commitConfigWithPendingPluginInstalls } from "./plugins-install-record-commit.js";
import {
commitConfigWithPendingPluginInstalls,
commitConfigWriteWithPendingPluginInstalls,
} from "./plugins-install-record-commit.js";
describe("commitConfigWithPendingPluginInstalls", () => {
beforeEach(() => {
@@ -155,4 +158,25 @@ describe("commitConfigWithPendingPluginInstalls", () => {
movedInstallRecords: false,
});
});
it("supports non-replace config writers without adding an undefined write options argument", async () => {
const writeConfigFile = vi.fn(async () => undefined);
const nextConfig: OpenClawConfig = {
gateway: {
mode: "local",
},
};
const result = await commitConfigWriteWithPendingPluginInstalls({
nextConfig,
commit: writeConfigFile,
});
expect(writeConfigFile).toHaveBeenCalledWith(nextConfig);
expect(result).toEqual({
config: nextConfig,
installRecords: {},
movedInstallRecords: false,
});
});
});