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

Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com>
This commit is contained in:
01zulfi
2025-06-17 09:45:23 +05:00
committed by Abdullah Atta
parent 154cf897b3
commit caba714798

View File

@@ -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();
}));