Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

core: fix notebooks parentId() tests (#8213)

01zulficaba7147989a
diff --git a/packages/core/__tests__/notebooks.test.js b/packages/core/__tests__/notebooks.test.js
index 3b9793864..fba60d650 100644
--- a/packages/core/__tests__/notebooks.test.js
+++ b/packages/core/__tests__/notebooks.test.js
@@ -55,10 +55,14 @@ test("updating notebook with empty title should throw", () =>
test("parentId() returns parentId if notebook is a subnotebook", () =>
notebookTest().then(async ({ db, id }) => {
const subId = await db.notebooks.add({ title: "Sub", id });
- expect(db.notebooks.parentId(subId)).toBe(id);
+ await db.relations.add(
+ { type: "notebook", id },
+ { type: "notebook", id, subId }
+ );
+ expect(await db.notebooks.parentId(subId)).toBe(id);
}));
test("parentId() returns undefined if notebook is not a subnotebook", () =>
notebookTest().then(async ({ db, id }) => {
- expect(db.notebooks.parentId(id)).toBeUndefined();
+ expect(await db.notebooks.parentId(id)).toBeUndefined();
}));