Skip to content

Build your personal knowledge base with Trilium Notes

test(server/utils): add edge case test for getNoteTitle

Panagiotis Papadopoulos46f28f4f09ed
diff --git a/src/services/utils.spec.ts b/src/services/utils.spec.ts
index 9fbb6c545a..68cb940cf8 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"
]
];