| 1 | import { generatePolicyRule } from "./policyWriter.js"; |
| 2 | |
| 3 | describe("policyWriter verification", () => { |
| 4 | it("should return display names for all tools", () => { |
| 5 | // Test Edit tool |
| 6 | expect(generatePolicyRule("Edit", { filepath: "test.txt" })).toBe("Edit"); |
| 7 | |
| 8 | // Test Write tool |
| 9 | expect(generatePolicyRule("Write", { filepath: "test.txt" })).toBe("Write"); |
| 10 | |
| 11 | // Test Read tool |
| 12 | expect(generatePolicyRule("Read", { filepath: "test.txt" })).toBe("Read"); |
| 13 | |
| 14 | // Test Bash tool with commands |
| 15 | expect(generatePolicyRule("Bash", { command: "ls -la" })).toBe("Bash(ls*)"); |
| 16 | }); |
| 17 | |
| 18 | it("should use exact tool names without case normalization", () => { |
| 19 | expect(generatePolicyRule("edit", { filepath: "test.txt" })).toBe("edit"); |
| 20 | expect(generatePolicyRule("EDIT", { filepath: "test.txt" })).toBe("EDIT"); |
| 21 | expect(generatePolicyRule("Edit", { filepath: "test.txt" })).toBe("Edit"); |
| 22 | }); |
| 23 | }); |