chore: initialize POM 2 repo (docs guards green; release gates recorded NOT RUN pending install)
This commit is contained in:
15
tests/events.test.ts
Normal file
15
tests/events.test.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
import { shouldBlockProjectCommand } from "../src/policy";
|
||||
|
||||
test("destructive-command policy blocks recursive deletion from or against project root", () => {
|
||||
const root = "/work/clockwork-sea";
|
||||
assert.equal(shouldBlockProjectCommand("rm -rf .", root, "clockwork-sea", root), true);
|
||||
assert.equal(shouldBlockProjectCommand("rm --recursive --force \"$PWD\"", root, "clockwork-sea", root), true);
|
||||
assert.equal(shouldBlockProjectCommand("find . -delete", root, "clockwork-sea", root), true);
|
||||
assert.equal(shouldBlockProjectCommand("git reset --hard HEAD~1", root, "clockwork-sea", root), true);
|
||||
assert.equal(shouldBlockProjectCommand("Remove-Item -Recurse -Force .", root, "clockwork-sea", root), true);
|
||||
assert.equal(shouldBlockProjectCommand("rm -rf /tmp/scratch", root, "clockwork-sea", "/tmp"), false);
|
||||
assert.equal(shouldBlockProjectCommand("rm -rf /work/clockwork-sea", root, "clockwork-sea", "/tmp"), true);
|
||||
assert.equal(shouldBlockProjectCommand("rm notes.txt", root, "clockwork-sea", root), false);
|
||||
});
|
||||
Reference in New Issue
Block a user