mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-28 13:26:04 -06:00
fix: ClawHub plugin installs do not count as installs (#113133)
This commit is contained in:
@@ -31,6 +31,7 @@ import {
|
||||
readConfigFileSnapshotForWrite,
|
||||
parseClawHubPluginSpec,
|
||||
promptYesNo,
|
||||
reportClawHubPluginInstallTelemetry,
|
||||
recordHookInstall,
|
||||
recordPluginInstall,
|
||||
resetPluginsCliTestState,
|
||||
@@ -1661,9 +1662,39 @@ describe("plugins cli install", () => {
|
||||
expect(readConfigFileSnapshotForWrite).toHaveBeenCalledTimes(2);
|
||||
expect(writeConfigFile).toHaveBeenCalledWith(enabledCfg);
|
||||
expect(runtimeLogsContain("Installed plugin: demo")).toBe(true);
|
||||
expect(reportClawHubPluginInstallTelemetry).toHaveBeenCalledWith({
|
||||
baseUrl: "https://clawhub.ai",
|
||||
packageName: "demo",
|
||||
version: "1.2.3",
|
||||
});
|
||||
expect(installPluginFromNpmSpec).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("does not report a ClawHub install when durable persistence fails", async () => {
|
||||
loadConfig.mockReturnValue(createEmptyPluginConfig());
|
||||
parseClawHubPluginSpec.mockReturnValue({ name: "demo" });
|
||||
installPluginFromClawHub.mockResolvedValue(
|
||||
createClawHubInstallResult({
|
||||
pluginId: "demo",
|
||||
packageName: "demo",
|
||||
version: "1.2.3",
|
||||
channel: "official",
|
||||
}),
|
||||
);
|
||||
enablePluginInConfig.mockReturnValue({ config: createEnabledPluginConfig("demo") });
|
||||
applyExclusiveSlotSelection.mockReturnValue({
|
||||
config: createEnabledPluginConfig("demo"),
|
||||
warnings: [],
|
||||
});
|
||||
writeConfigFile.mockRejectedValueOnce(new Error("persistence failed"));
|
||||
|
||||
await expect(runPluginsCommand(["plugins", "install", "clawhub:demo"])).rejects.toThrow(
|
||||
"persistence failed",
|
||||
);
|
||||
|
||||
expect(reportClawHubPluginInstallTelemetry).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("passes ClawHub risk acknowledgement to explicit ClawHub installs", async () => {
|
||||
loadConfig.mockReturnValue(createEmptyPluginConfig());
|
||||
parseClawHubPluginSpec.mockReturnValue({ name: "demo" });
|
||||
|
||||
Reference in New Issue
Block a user