Skip to content

Build your personal knowledge base with Trilium Notes

test(collection/presentation): fix broken test

Elian Dorane5c7feb2aa15
diff --git a/apps/client/src/widgets/collections/presentation/model.spec.ts b/apps/client/src/widgets/collections/presentation/model.spec.ts
index 7f63d8a42a..e5b5b49b67 100644
--- a/apps/client/src/widgets/collections/presentation/model.spec.ts
+++ b/apps/client/src/widgets/collections/presentation/model.spec.ts
@@ -19,7 +19,8 @@ describe("Presentation model", () => {
children: [
{
id: "slide2",
- title: "First-sub"
+ title: "First-sub",
+ content: `<p>Go to&nbsp;<a class="reference-link" href="#root/other">Other note</a>.</p>`
}
]
},
@@ -37,6 +38,10 @@ describe("Presentation model", () => {
}
]
});
+ buildNote({
+ id: "other",
+ title: "Other note"
+ });
data = await buildPresentationModel(presentationNote);
});
@@ -68,11 +73,11 @@ describe("Presentation model", () => {
});
it("rewrites links to other slides", () => {
- expect(data.slides[1].content.__html).toStrictEqual(`<div class="ck-content"><p>Go to&nbsp;<a class="reference-link" href="#/slide1"><span class="bx bx-folder"></span>First slide</a>.</p></div>`);
- expect(data.slides[1].verticalSlides![0].content.__html).toStrictEqual(`<div class="ck-content"><p>Go to&nbsp;<a class="reference-link" href="#/slide2"><span class="bx bx-note"></span>First-sub</a>.</p></div>`);
+ expect(data.slides[1].content.__html).toStrictEqual(`<div class="ck-content"><p>Go to&nbsp;<a class="reference-link" href="#/slide-slide1"><span class="bx bx-folder"></span>First slide</a>.</p></div>`);
+ expect(data.slides[1].verticalSlides![0].content.__html).toStrictEqual(`<div class="ck-content"><p>Go to&nbsp;<a class="reference-link" href="#/slide-slide2"><span class="bx bx-note"></span>First-sub</a>.</p></div>`);
});
- it("doesn't rewrite links if they are not part of the slideshow", () => {
-
+ it("rewrites links even if they are not part of the slideshow", () => {
+ expect(data.slides[0].verticalSlides![0].content.__html).toStrictEqual(`<div class="ck-content"><p>Go to&nbsp;<a class="reference-link" href="#/slide-other"><span class="bx bx-note"></span>Other note</a>.</p></div>`);
});
});