Tests: extend exec allowlist glob coverage

This commit is contained in:
Vincent Koc
2026-03-12 04:01:49 -04:00
parent 9aeaa19e9e
commit 97683071b5
2 changed files with 13 additions and 2 deletions

View File

@@ -7,8 +7,18 @@ describe("matchesExecAllowlistPattern", () => {
expect(matchesExecAllowlistPattern("/tmp/a?b", "/tmp/acb")).toBe(true);
});
it("keeps ** matching across path separators", () => {
expect(matchesExecAllowlistPattern("/tmp/**/tool", "/tmp/a/b/tool")).toBe(true);
});
it.runIf(process.platform !== "win32")("preserves case sensitivity on POSIX", () => {
expect(matchesExecAllowlistPattern("/tmp/Allowed-Tool", "/tmp/allowed-tool")).toBe(false);
expect(matchesExecAllowlistPattern("/tmp/Allowed-Tool", "/tmp/Allowed-Tool")).toBe(true);
});
it.runIf(process.platform === "win32")("preserves case-insensitive matching on Windows", () => {
expect(matchesExecAllowlistPattern("C:/Tools/Allowed-Tool", "c:/tools/allowed-tool")).toBe(
true,
);
});
});