feat: restore current project copies and choose text mapping

This commit is contained in:
muena
2026-09-27 10:12:46 +02:00
parent ec327a5220
commit 94806aa049
9 changed files with 171 additions and 81 deletions

View File

@@ -72,6 +72,15 @@ describe("Velum-Projektstände", () => {
expect(await fs.readFile(join(copyPath, "Unterordner", "PERSON_01.txt"), "utf8")).toBe("PERSON_01");
expect(await fs.readdir(copyPath)).toEqual(["Unterordner"]);
expect(await fs.readFile(join(created.directory, "run.json"), "utf8")).toContain("Max Mustermann");
await fs.writeFile(join(copyPath, "Antwort.txt"), "PERSON_01 antwortet");
const current = await project.scanRestorableCopyFiles(created.run, created.directory);
expect(current.root).toBe(copyPath);
expect(current.files.map((file) => file.relPath)).toEqual(["Antwort.txt", "Unterordner/PERSON_01.txt"]);
const history = await project.scanRestorableCopyFiles(created.run, created.directory, false);
expect(history.root).toBe(join(created.directory, "files"));
expect(history.files.map((file) => file.relPath)).toEqual(["Unterordner/PERSON_01.txt"]);
expect(project.restoreTextWithCount("PERSON_01 antwortet", created.run.mapping))
.toEqual({ text: "Max Mustermann antwortet", replacements: 1 });
await expect(project.publishProjectCopies(created.run, created.directory)).rejects.toThrow("bereits vorhanden");
expect((await project.listRuns(source, support))[0].run.copyPath).toBe(copyPath);
});