openclaw/src/gateway/node-command-policy.test.ts

15 lines
545 B
TypeScript

import { describe, expect, it } from "vitest";
import { normalizeDeclaredNodeCommands } from "./node-command-policy.js";
describe("gateway/node-command-policy", () => {
it("normalizes declared node commands against the allowlist", () => {
const allowlist = new Set(["canvas.snapshot", "system.run"]);
expect(
normalizeDeclaredNodeCommands({
declaredCommands: [" canvas.snapshot ", "", "system.run", "system.run", "screen.record"],
allowlist,
}),
).toEqual(["canvas.snapshot", "system.run"]);
});
});