fix: migrate placeholders after encoded path separators
This commit is contained in:
@@ -61,3 +61,36 @@ it("migriert einen künstlichen Altbestand verlustarm ohne den Quellordner zu ä
|
||||
expect(restorePath(file.output, run.mapping, run.matchModes)).toBe("Müller GmbH.txt");
|
||||
expect(await fs.readFile(join(project, legacyName), "utf8")).toBe(legacyContent);
|
||||
});
|
||||
|
||||
it("ersetzt Platzhalter hinter URL-kodierten Pfadtrennern im Dateinamen", async () => {
|
||||
const root = await fs.mkdtemp(join(tmpdir(), "velum-encoded-name-test-"));
|
||||
roots.push(root);
|
||||
const project = join(root, "Projekt");
|
||||
const targetSupport = join(root, "VelumSupport");
|
||||
const manifestFile = join(root, "OldSupport", "projects", "manifest.json");
|
||||
const previewFile = join(root, "Vorschau.md");
|
||||
await fs.mkdir(join(project, "KUNDE_A"), { recursive: true });
|
||||
await fs.mkdir(join(root, "OldSupport", "projects"), { recursive: true });
|
||||
const source = "KUNDE_A/%2fkunde_a%2fzc.asddls";
|
||||
await fs.writeFile(join(project, source), "Technischer Inhalt");
|
||||
await fs.writeFile(manifestFile, JSON.stringify({
|
||||
version: 1, projectPath: project,
|
||||
projectTerms: [{ id: "t1", term: "Alpha GmbH", category: "Kunde", enabled: true, aliases: [] }],
|
||||
variantTable: [
|
||||
{ termId: "t1", termVariant: "Alpha GmbH", placeholderVariant: "KUNDE_A", style: "typed", boundary: "strict" },
|
||||
{ termId: "t1", termVariant: "alpha_gmbh", placeholderVariant: "kunde_a", style: "snake", boundary: "strict" },
|
||||
],
|
||||
}));
|
||||
const preview = await migrate({ project, manifestFile, targetSupport, previewFile });
|
||||
expect(preview.summary.replacements).toBe(2);
|
||||
const report = await fs.readFile(previewFile, "utf8");
|
||||
expect(report).toContain('"KUNDE_A/%2fkunde_a%2fzc.asddls"');
|
||||
expect(report).toContain('"KUNDE_100001/%2fKUNDE_100002%2fzc.asddls"');
|
||||
expect(report).not.toContain("Alpha GmbH");
|
||||
|
||||
const result = await migrate({ project, manifestFile, targetSupport, apply: true });
|
||||
const run = JSON.parse(await fs.readFile(join(result.runDir!, "run.json"), "utf8"));
|
||||
expect(restorePath(run.files[0].output, run.mapping, run.matchModes))
|
||||
.toBe("Alpha GmbH/%2falpha_gmbh%2fzc.asddls");
|
||||
expect(await fs.readFile(join(project, source), "utf8")).toBe("Technischer Inhalt");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user