test: cover ClawHub plugin install uninstall

This commit is contained in:
Peter Steinberger
2026-04-26 11:28:08 +01:00
parent 3979fce4f9
commit 8a52c7b3d9
5 changed files with 203 additions and 468 deletions

View File

@@ -688,6 +688,10 @@ export function registerPluginsCli(program: Command) {
nextConfig,
...(snapshot.hash !== undefined ? { baseHash: snapshot.hash } : {}),
});
const directoryResult = await applyPluginUninstallDirectoryRemoval(plan.directoryRemoval);
for (const warning of directoryResult.warnings) {
defaultRuntime.log(theme.warn(warning));
}
await refreshPluginRegistryAfterConfigMutation({
config: nextConfig,
reason: "source-changed",
@@ -696,10 +700,6 @@ export function registerPluginsCli(program: Command) {
warn: (message) => defaultRuntime.log(theme.warn(message)),
},
});
const directoryResult = await applyPluginUninstallDirectoryRemoval(plan.directoryRemoval);
for (const warning of directoryResult.warnings) {
defaultRuntime.log(theme.warn(warning));
}
const removed = formatUninstallActionLabels({
...plan.actions,

View File

@@ -258,8 +258,11 @@ describe("plugins cli uninstall", () => {
const configWriteOrder = writeConfigFile.mock.invocationCallOrder[0] ?? 0;
const deleteOrder =
applyPluginUninstallDirectoryRemoval.mock.invocationCallOrder[0] ?? Number.MAX_SAFE_INTEGER;
const refreshOrder =
refreshPluginRegistry.mock.invocationCallOrder[0] ?? Number.MAX_SAFE_INTEGER;
expect(configWriteOrder).toBeGreaterThan(0);
expect(deleteOrder).toBeGreaterThan(configWriteOrder);
expect(refreshOrder).toBeGreaterThan(deleteOrder);
expect(applyPluginUninstallDirectoryRemoval).toHaveBeenCalledWith({
target: ALPHA_INSTALL_PATH,
});