mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-03 07:01:40 +00:00
* fix(codex): drain dynamic-tool handlers before side-thread cleanup * refactor(protocol): rename question ids to questionId and flatten answer maps * refactor(protocol): slim worker stack and unify session-catalog shapes * refactor(protocol): delete dead public surface and polish packaging * feat(protocol): track release-train vintage on gateway methods and schemas * fix(apps): align question surfaces merged from main with reshaped protocol * test(health): shape secret fixtures to scanner-safe token names * test(health): use scanner-safe token fixtures * fix(apps): align question surfaces merged from main with reshaped protocol * fix(ci): prove reshaped protocol in shallow checks * fix(ui): align sidebar question fixtures with protocol * fix(apps): read flat Swift question answers * fix(apps): align question surfaces merged from main with reshaped protocol * fix(apps): refresh native question inventory * fix(apps): align macOS snapshot fixtures with protocol * fix(ui): align narration question fixture with protocol
57 lines
2.0 KiB
TypeScript
57 lines
2.0 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import {
|
|
validatePluginsInstallParams,
|
|
validatePluginsListParams,
|
|
validatePluginsRefreshParams,
|
|
validatePluginsSearchParams,
|
|
validatePluginsSetEnabledParams,
|
|
validatePluginsUninstallParams,
|
|
} from "./index.js";
|
|
|
|
describe("plugin lifecycle protocol validators", () => {
|
|
it("validates plugin metadata refresh params", () => {
|
|
expect(validatePluginsRefreshParams({})).toBe(true);
|
|
expect(validatePluginsRefreshParams({ unexpected: true })).toBe(false);
|
|
});
|
|
|
|
it("keeps list params closed", () => {
|
|
expect(validatePluginsListParams({})).toBe(true);
|
|
expect(validatePluginsListParams({ unexpected: true })).toBe(false);
|
|
});
|
|
|
|
it("validates bounded plugin search requests", () => {
|
|
expect(validatePluginsSearchParams({ query: "memory", limit: 20 })).toBe(true);
|
|
expect(validatePluginsSearchParams({ query: "memory", limit: 101 })).toBe(false);
|
|
});
|
|
|
|
it("keeps official and ClawHub install requests distinct", () => {
|
|
expect(
|
|
validatePluginsInstallParams({
|
|
source: "clawhub",
|
|
packageName: "memory-plus",
|
|
version: "2.1.0",
|
|
acknowledgeClawHubRisk: true,
|
|
}),
|
|
).toBe(true);
|
|
expect(validatePluginsInstallParams({ source: "official", pluginId: "workboard" })).toBe(true);
|
|
expect(
|
|
validatePluginsInstallParams({
|
|
source: "official",
|
|
pluginId: "workboard",
|
|
packageName: "memory-plus",
|
|
}),
|
|
).toBe(false);
|
|
});
|
|
|
|
it("validates uninstall requests", () => {
|
|
expect(validatePluginsUninstallParams({ pluginId: "memory-plus" })).toBe(true);
|
|
expect(validatePluginsUninstallParams({ pluginId: "" })).toBe(false);
|
|
expect(validatePluginsUninstallParams({})).toBe(false);
|
|
});
|
|
|
|
it("validates enablement mutations", () => {
|
|
expect(validatePluginsSetEnabledParams({ pluginId: "workboard", enabled: true })).toBe(true);
|
|
expect(validatePluginsSetEnabledParams({ pluginId: "workboard", enabled: "yes" })).toBe(false);
|
|
});
|
|
});
|