| 1 | import { describe, expect, it } from "bun:test"; |
| 2 | |
| 3 | import { resolve } |
| 4 | |
| 5 | describe("resolve", () |
| 6 | it("resolves against the directory the README sits in", |
| 7 | expect(resolve("logo.png |
| 8 | expect(resolve("./logo.png |
| 9 | expect(resolve("../logo.png |
| 10 | }); |
| 11 | |
| 12 | it("treats a leading slash as the repository root", |
| 13 | expect(resolve("/logo.png |
| 14 | }); |
| 15 | |
| 16 | it("never escapes the repository", |
| 17 | expect(resolve("../../../etc/passwd |
| 18 | }); |
| 19 | |
| 20 | it("leaves a root README's links alone", |
| 21 | expect(resolve("docs/guide.md |
| 22 | }); |
| 23 | }); |