Initial curated Unraid-AppOps-Gateway source from 3bd6f6fee310125bfbb4d4650389a817f498724d
This commit is contained in:
commit
1dfbca08a1
528 files changed
+131054
No files matched your search
@@ -0,0 +1,38 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { describe, it } from "node:test";
|
||||
|
||||
import { buildCommandActionView } from "./commandActionView.ts";
|
||||
|
||||
describe("buildCommandActionView", () => {
|
||||
it("labels allowed command actions as policy-gated execution", () => {
|
||||
const view = buildCommandActionView({ intent: "container.restart", policy: "allowed", risk: "medium" });
|
||||
|
||||
assert.equal(view.tone, "execute");
|
||||
assert.equal(view.buttonLabel, "Uitvoeren: container.restart");
|
||||
assert.match(view.copy, /unsupported\/failed/i);
|
||||
});
|
||||
|
||||
it("keeps approval-required command actions explicit and non-executing", () => {
|
||||
const view = buildCommandActionView({ intent: "stack.redeploy", policy: "approval_required", risk: "high" });
|
||||
|
||||
assert.equal(view.tone, "approval");
|
||||
assert.equal(view.buttonLabel, "stack.redeploy");
|
||||
assert.match(view.copy, /niet uitgevoerd/i);
|
||||
});
|
||||
|
||||
it("marks blocked command actions as unavailable for approval or execution", () => {
|
||||
const view = buildCommandActionView({ intent: "volume.delete", policy: "blocked", risk: "high" });
|
||||
|
||||
assert.equal(view.tone, "blocked");
|
||||
assert.equal(view.buttonLabel, "Geblokkeerd: volume.delete");
|
||||
assert.match(view.copy, /voert deze actie niet uit/i);
|
||||
});
|
||||
|
||||
it("routes critical command actions through override guidance first", () => {
|
||||
const view = buildCommandActionView({ intent: "container.restart", policy: "allowed", risk: "critical" });
|
||||
|
||||
assert.equal(view.tone, "critical");
|
||||
assert.equal(view.buttonLabel, "container.restart");
|
||||
assert.match(view.copy, /Directe uitvoering is geblokkeerd/i);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user