import { join, parse } from "node:path"; import { describe, expect, it } from "vitest"; import { isDangerousPath } from "../clone"; describe("git-safe clone path validation", () => { it("accepts a deep native path", () => { const target = join( process.cwd(), "output", "tmp", "research", "repos", "owner", "repo", ); expect(isDangerousPath(target)).toBeNull(); }); it("rejects native root and shallow paths", () => { const root = parse(process.cwd()).root; expect(isDangerousPath(root)).toBe("path is root directory"); expect(isDangerousPath(join(root, "repo"))).toMatch(/path is too shallow/); }); });