test(calendar): relation as custom title with attribute relation

This commit is contained in:
Elian Doran 2025-02-28 20:13:37 +02:00
parent f953f6514f
commit a8b119e4df
No known key found for this signature in database

View File

@ -111,4 +111,18 @@ describe("Building events", () => {
expect(events[1]).toMatchObject({ title: "Note 2", start: "2025-05-07" }); expect(events[1]).toMatchObject({ title: "Note 2", start: "2025-05-07" });
}); });
it("discards relation as custom title with custom relation", async () => {
const noteIds = buildNotes([
{ id: "myParentNote", title: "My parent note" },
{ id: "mySharedTitle", title: "My custom title", "~myTitle": "myParentNote", "#calendar:title": "~myTitle" },
{ title: "Note 1", "~myTitle": "mySharedTitle", "#startDate": "2025-05-05", "#calendar:title": "~myTitle" },
{ title: "Note 2", "#startDate": "2025-05-07", "#calendar:title": "~myTitle" },
]);
const events = await CalendarView.buildEvents(noteIds);
expect(events).toHaveLength(2);
expect(events[0]).toMatchObject({ title: "My shared custom title", start: "2025-05-05" });
expect(events[1]).toMatchObject({ title: "Note 2", start: "2025-05-07" });
});
}); });