fix: restore current in-place project files

This commit is contained in:
muena
2026-10-06 13:17:18 +02:00
parent 43fbf46014
commit 0ec5b0745e
3 changed files with 28 additions and 3 deletions

View File

@@ -99,6 +99,27 @@ describe("Velum-Projektstände", () => {
expect(await project.loadProjectEntityTypes(other, support)).toBeNull();
});
it("stellt aktuelle In-Place-Dateien aus dem Projektordner und frühere Stände aus dem Snapshot bereit", async () => {
const root = await fs.mkdtemp(join(tmpdir(), "velum-current-source-test-"));
roots.push(root);
const source = join(root, "Projekt");
const support = join(root, "Raycast");
await fs.mkdir(source);
const created = await project.createRun(source, support);
created.run.inPlace = true;
created.run.files = [{ source: "Notiz.txt", output: "Notiz.txt", kind: "text" }];
await fs.writeFile(join(created.directory, "files", "Notiz.txt"), "PERSON_01");
await fs.writeFile(join(source, "Notiz.txt"), "PERSON_01");
await fs.writeFile(join(source, "Antwort.txt"), "PERSON_01 antwortet");
const current = await project.scanRestorableCopyFiles(created.run, created.directory);
expect(current.root).toBe(source);
expect(current.files.map((file) => file.relPath)).toEqual(["Antwort.txt", "Notiz.txt"]);
const historical = await project.scanRestorableCopyFiles(created.run, created.directory, false);
expect(historical.root).toBe(join(created.directory, "files"));
expect(historical.files.map((file) => file.relPath)).toEqual(["Notiz.txt"]);
});
it("ersetzt nur bestätigte Vorkommen und stellt Dateinamen wieder her", () => {
const hits = [
{ id: "a", start: 0, end: 3, placeholder: "PERSON_01" },