Skip to content

Commit 36b0da1

Browse files
committed
test: add missing noprefix test for hunk show command
Adds regression test for hunk show with diff.noprefix=true, completing the test coverage for all git-backed commands that use withNormalizedDiffPrefixes().
1 parent 6fface2 commit 36b0da1

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

test/loaders.test.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,26 @@ describe("loadAppBootstrap", () => {
366366
expect(bootstrap.changeset.files.map((file) => file.path)).toEqual(["alpha.ts"]);
367367
});
368368

369+
test("loads show output when diff.noprefix is enabled", async () => {
370+
const dir = createTempRepo("hunk-show-noprefix-");
371+
372+
writeFileSync(join(dir, "alpha.ts"), "export const alpha = 1;\n");
373+
git(dir, "add", "alpha.ts");
374+
git(dir, "commit", "-m", "initial");
375+
376+
git(dir, "config", "--local", "diff.noprefix", "true");
377+
writeFileSync(join(dir, "alpha.ts"), "export const alpha = 2;\n");
378+
git(dir, "add", "alpha.ts");
379+
git(dir, "commit", "-m", "update alpha");
380+
381+
const bootstrap = await loadFromRepo(dir, {
382+
kind: "show",
383+
options: { mode: "auto" },
384+
});
385+
386+
expect(bootstrap.changeset.files.map((file) => file.path)).toEqual(["alpha.ts"]);
387+
});
388+
369389
test("loads stash show output as a full review changeset", async () => {
370390
const dir = createTempRepo("hunk-stash-");
371391

0 commit comments

Comments
 (0)