feat: add more tests for tool built-ins (#5)

This commit is contained in:
Charles Packer
2025-10-25 11:33:30 -07:00
committed by GitHub
parent dd773bf285
commit da2c50cbeb
19 changed files with 792 additions and 1 deletions

View File

@@ -4,6 +4,7 @@ import { checkPermission } from "../permissions/checker";
import type { PermissionRules } from "../permissions/types";
test("Read within working directory is auto-allowed", () => {
if (process.platform === "win32") return; // Skip on Windows - Unix paths
const result = checkPermission(
"Read",
{ file_path: "src/test.ts" },
@@ -16,6 +17,8 @@ test("Read within working directory is auto-allowed", () => {
});
test("Read outside working directory requires approval", () => {
if (process.platform === "win32") return; // Skip on Windows - Unix paths
const result = checkPermission(
"Read",
{ file_path: "/Users/test/other-project/file.ts" },
@@ -98,6 +101,8 @@ test("Dangerous commands don't offer persistence", () => {
});
test("Read outside working directory suggests directory pattern", () => {
if (process.platform === "win32") return; // Skip on Windows - Unix paths
const context = analyzeApprovalContext(
"Read",
{ file_path: "/Users/test/docs/api.md" },