From 46f28f4f09ed12f69f0379bbc6e7f21b37c2b185 Mon Sep 17 00:00:00 2001 From: Panagiotis Papadopoulos Date: Fri, 31 Jan 2025 21:39:42 +0100 Subject: [PATCH] test(server/utils): add edge case test for getNoteTitle MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit when the noteMeta title consists of just spaces, it should fall back to "normal" handling again → currently this fails --- src/services/utils.spec.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/services/utils.spec.ts b/src/services/utils.spec.ts index 9fbb6c545..68cb940cf 100644 --- a/src/services/utils.spec.ts +++ b/src/services/utils.spec.ts @@ -270,6 +270,12 @@ describe("#getNoteTitle", () => { //@ts-expect-error - passing in incomplete noteMeta - but we only care about the title prop here ["test_file.md", true, { title: ""}], "test file" + ], + [ + "when a noteMeta object is passed, but the title prop is empty, it should try to handle the filename as if no noteMeta was passed", + //@ts-expect-error - passing in incomplete noteMeta - but we only care about the title prop here + ["test_file.json", false, { title: " "}], + "test_file.json" ] ];