chore: generate
This commit is contained in:
@@ -289,31 +289,27 @@ describe("Vcs diff", () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
test(
|
test("diff('git') keeps carriage returns inside patch hunks", async () => {
|
||||||
"diff('git') keeps carriage returns inside patch hunks",
|
await using tmp = await tmpdir({ git: true })
|
||||||
async () => {
|
await fs.writeFile(path.join(tmp.path, "file.txt"), "keep\nsame\rdiff --git inside\ndelete\n", "utf-8")
|
||||||
await using tmp = await tmpdir({ git: true })
|
await $`git add .`.cwd(tmp.path).quiet()
|
||||||
await fs.writeFile(path.join(tmp.path, "file.txt"), "keep\nsame\rdiff --git inside\ndelete\n", "utf-8")
|
await $`git commit --no-gpg-sign -m "add file"`.cwd(tmp.path).quiet()
|
||||||
await $`git add .`.cwd(tmp.path).quiet()
|
await fs.writeFile(path.join(tmp.path, "file.txt"), "keep\nadd\nsame\rdiff --git inside\n", "utf-8")
|
||||||
await $`git commit --no-gpg-sign -m "add file"`.cwd(tmp.path).quiet()
|
|
||||||
await fs.writeFile(path.join(tmp.path, "file.txt"), "keep\nadd\nsame\rdiff --git inside\n", "utf-8")
|
|
||||||
|
|
||||||
await withVcsOnly(tmp.path, async () => {
|
await withVcsOnly(tmp.path, async () => {
|
||||||
const diff = await AppRuntime.runPromise(
|
const diff = await AppRuntime.runPromise(
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
const vcs = yield* Vcs.Service
|
const vcs = yield* Vcs.Service
|
||||||
return yield* vcs.diff("git")
|
return yield* vcs.diff("git")
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
const file = diff.find((item) => item.file === "file.txt")
|
const file = diff.find((item) => item.file === "file.txt")
|
||||||
|
|
||||||
expect(file?.patch).toContain(" same\rdiff --git inside")
|
expect(file?.patch).toContain(" same\rdiff --git inside")
|
||||||
expect(file?.patch).toContain("-delete")
|
expect(file?.patch).toContain("-delete")
|
||||||
expect(() => parsePatch(file?.patch ?? "")).not.toThrow()
|
expect(() => parsePatch(file?.patch ?? "")).not.toThrow()
|
||||||
})
|
})
|
||||||
},
|
}, 20_000)
|
||||||
20_000,
|
|
||||||
)
|
|
||||||
|
|
||||||
test("diff('branch') returns changes against default branch", async () => {
|
test("diff('branch') returns changes against default branch", async () => {
|
||||||
await using tmp = await tmpdir({ git: true })
|
await using tmp = await tmpdir({ git: true })
|
||||||
|
|||||||
Reference in New Issue
Block a user