forked from r.muellner/velum-raycast
Restore embedded placeholders in Markdown project exports
This commit is contained in:
@@ -168,6 +168,13 @@ describe("Velum-Projektstände", () => {
|
||||
expect(project.restoreText("BerichtPERSON_01", {
|
||||
PERSON_01: { original: "Max Mustermann", type: "PERSON" },
|
||||
})).toBe("BerichtPERSON_01");
|
||||
expect(project.restoreText("Fachkonzept `PROJEKT_01_Fachkonzept_V03.docx` widerspricht Kommentar PERSON_61 (ID 1088)", {
|
||||
PROJEKT_01: { original: "Beispielprojekt", type: "PROJEKT" },
|
||||
PERSON_61: { original: "Mara Muster", type: "PERSON" },
|
||||
}, undefined, true)).toBe("Fachkonzept `Beispielprojekt_Fachkonzept_V03.docx` widerspricht Kommentar Mara Muster (ID 1088)");
|
||||
expect(project.restoreText("PERSON_0101 und PERSON_01", {
|
||||
PERSON_01: { original: "Max Mustermann", type: "PERSON" },
|
||||
}, undefined, true)).toBe("PERSON_0101 und Max Mustermann");
|
||||
expect(project.restorePath("PERSON_0101.txt", {
|
||||
PERSON_01: { original: "Falsch", type: "PERSON" },
|
||||
PERSON_0101: { original: "Richtig", type: "PERSON" },
|
||||
@@ -179,6 +186,21 @@ describe("Velum-Projektstände", () => {
|
||||
expect(() => project.safeRelativePath("../geheim.txt")).toThrow();
|
||||
});
|
||||
|
||||
it("verwendet ältere Zuordnungen nur bei übereinstimmender Bedeutung und meldet übrig gebliebene Markdown-Platzhalter", () => {
|
||||
const current = { PERSON_01: { original: "Alex Beispiel", type: "PERSON" } };
|
||||
const older = [
|
||||
{ PERSON_61: { original: "Mara Muster", type: "PERSON" }, PROJEKT_01: { original: "Projekt Eins", type: "PROJEKT" } },
|
||||
{ PERSON_61: { original: "Mara Muster", type: "PERSON" }, PROJEKT_01: { original: "Projekt Zwei", type: "PROJEKT" } },
|
||||
];
|
||||
const mapping = project.withUnambiguousHistoricalMappings(current, older);
|
||||
expect(mapping.PERSON_61?.original).toBe("Mara Muster");
|
||||
expect(mapping.PROJEKT_01).toBeUndefined();
|
||||
const restored = project.restoreText("PERSON_61 und PROJEKT_01", mapping, undefined, true);
|
||||
expect(restored).toBe("Mara Muster und PROJEKT_01");
|
||||
expect(project.unresolvedPlaceholderIds(restored, [current, ...older])).toEqual(["PROJEKT_01"]);
|
||||
expect(project.isMarkdownFile("Notizen.MD")).toBe(true);
|
||||
});
|
||||
|
||||
it("übernimmt API-Trefferpositionen auch nach einem Emoji korrekt", () => {
|
||||
const text = "😀 Max";
|
||||
const spans = project.toUtf16Offsets(text, [{ id: "max", start: 2, end: 5, placeholder: "PERSON_01" }]);
|
||||
|
||||
Reference in New Issue
Block a user