Initial curated Unraid-AppOps-Gateway source from 3bd6f6fee310125bfbb4d4650389a817f498724d

This commit is contained in:
Public Source Publisher committed 2026-10-01 01:35:57 +02:00
commit 1dfbca08a1
528 files changed
+131054

No files matched your search

+48
View File
@@ -0,0 +1,48 @@
import assert from "node:assert/strict";
import { describe, it } from "node:test";
import { getPolicyActionState, getPolicyActionButtonLabel } from "./policyActionState.ts";
describe("getPolicyActionState", () => {
it("blocks critical actions unless an explicit override exists", () => {
assert.deepEqual(getPolicyActionState("allowed", "critical", true, false), {
kind: "critical_override_required",
interactive: true,
fallbackMessage: "Kritieke actie vereist handmatige override in Safety Center.",
});
});
it("marks blocked policy decisions as non-interactive", () => {
assert.deepEqual(getPolicyActionState("blocked", "high", true, true), {
kind: "blocked",
interactive: false,
fallbackMessage: null,
});
});
it("requires an approval handler for approval-required actions", () => {
assert.deepEqual(getPolicyActionState("approval_required", "medium", false, false), {
kind: "approval",
interactive: false,
fallbackMessage: "Goedkeuringsflow is voor deze actie nog niet aangesloten.",
});
});
it("requires an execute handler for allowed actions", () => {
assert.deepEqual(getPolicyActionState("allowed", "low", false, false), {
kind: "execute",
interactive: false,
fallbackMessage: "Deze actie heeft nog geen veilige uitvoerflow in AppOps V1.",
});
});
it("keeps approval-required action labels explicit", () => {
assert.equal(getPolicyActionButtonLabel("approval_required", "Scan All"), "Vraag goedkeuring: Scan All");
assert.equal(getPolicyActionButtonLabel("approval_required", "Pause All"), "Vraag goedkeuring: Pause All");
});
it("does not alter allowed or blocked action labels", () => {
assert.equal(getPolicyActionButtonLabel("allowed", "Scan"), "Scan");
assert.equal(getPolicyActionButtonLabel("blocked", "Delete Data Volume"), "Delete Data Volume");
});
});