|
| 1 | +// PR wrapper tests cover maintainer helper command delegation. |
| 2 | +import { readFileSync } from "node:fs"; |
| 3 | +import { describe, expect, it } from "vitest"; |
| 4 | + |
| 5 | +function readScript(path: string): string { |
| 6 | +return readFileSync(path, "utf8"); |
| 7 | +} |
| 8 | + |
| 9 | +describe("scripts/pr wrappers", () => { |
| 10 | +it("keeps the main PR helper usage and command table aligned", () => { |
| 11 | +const script = readScript("scripts/pr"); |
| 12 | + |
| 13 | +expect(script).toContain("export NO_COLOR=1"); |
| 14 | +expect(script).toContain("unset COLORTERM"); |
| 15 | +expect(script).toContain("scripts/pr review-init <PR>"); |
| 16 | +expect(script).toContain("scripts/pr prepare-run <PR>"); |
| 17 | +expect(script).toContain("scripts/pr merge-run <PR>"); |
| 18 | +expect(script).toContain('review_init "$pr"'); |
| 19 | +expect(script).toContain('prepare_run "$pr"'); |
| 20 | +expect(script).toContain('merge_run "$pr"'); |
| 21 | +}); |
| 22 | + |
| 23 | +it("keeps merge wrapper modes delegated to the main PR helper", () => { |
| 24 | +const script = readScript("scripts/pr-merge"); |
| 25 | + |
| 26 | +expect(script).toContain("scripts/pr-merge <PR>"); |
| 27 | +expect(script).toContain('exec "$base" merge-verify "$1"'); |
| 28 | +expect(script).toContain('exec "$base" merge-verify "$pr"'); |
| 29 | +expect(script).toContain('exec "$base" merge-run "$pr"'); |
| 30 | +}); |
| 31 | + |
| 32 | +it("keeps prepare wrapper modes delegated to the main PR helper", () => { |
| 33 | +const script = readScript("scripts/pr-prepare"); |
| 34 | + |
| 35 | +expect(script).toContain("scripts/pr-prepare <init|validate-commit|gates|push|run> <PR>"); |
| 36 | +for (const mode of ["init", "validate-commit", "gates", "push", "run"]) { |
| 37 | +expect(script).toContain(`${mode})`); |
| 38 | +} |
| 39 | +expect(script).toContain('exec "$base" prepare-init "$pr"'); |
| 40 | +expect(script).toContain('exec "$base" prepare-validate-commit "$pr"'); |
| 41 | +expect(script).toContain('exec "$base" prepare-gates "$pr"'); |
| 42 | +expect(script).toContain('exec "$base" prepare-push "$pr"'); |
| 43 | +expect(script).toContain('exec "$base" prepare-run "$pr"'); |
| 44 | +}); |
| 45 | + |
| 46 | +it("keeps review wrapper delegated to review-init", () => { |
| 47 | +const script = readScript("scripts/pr-review"); |
| 48 | + |
| 49 | +expect(script).toContain('base="$script_dir/pr"'); |
| 50 | +expect(script).toContain('exec "$base" review-init "$@"'); |
| 51 | +}); |
| 52 | +}); |