diff --git a/packages/core/__tests__/notes.test.js b/packages/core/__tests__/notes.test.js index 8e011a4ae..b2b274872 100644 --- a/packages/core/__tests__/notes.test.js +++ b/packages/core/__tests__/notes.test.js @@ -37,11 +37,11 @@ test("get delta of note", () => test("delete note", () => noteTest().then(async ({ db, id }) => { - let notebookId = await db.notebooks.add(TEST_NOTEBOOK); - let topic = await db.notebooks - .notebook(notebookId) - .topics.topic("General") - .add(id); + let { id: notebookId } = await db.notebooks.add(TEST_NOTEBOOK); + let topics = db.notebooks.notebook(notebookId).topics; + let topic = topics.topic("General"); + await topic.add(id); + topic = topics.topic("General"); expect(topic.all.findIndex(v => v.id === id)).toBeGreaterThan(-1); await db.notes.delete(id); expect(db.notes.note(id)).toBeUndefined(); @@ -272,11 +272,12 @@ test("add note to topic", () => test("duplicate note to topic should not be added", () => noteTest().then(async ({ db, id }) => { - let notebookId = await db.notebooks.add({ title: "Hello" }); + let { id: notebookId } = await db.notebooks.add({ title: "Hello" }); let topics = db.notebooks.notebook(notebookId).topics; await topics.add("Home"); let topic = topics.topic("Home"); await topic.add(id); + topic = topics.topic("Home"); expect(topic.all.length).toBe(1); })); diff --git a/packages/core/__tests__/trash.test.js b/packages/core/__tests__/trash.test.js index ea0ba93df..ec59f9ffa 100644 --- a/packages/core/__tests__/trash.test.js +++ b/packages/core/__tests__/trash.test.js @@ -10,7 +10,7 @@ beforeEach(() => StorageInterface.clear()); test("delete a note", () => noteTest().then(async ({ db, id }) => { - let nbId = await db.notebooks.add(TEST_NOTEBOOK); + let { id: nbId } = await db.notebooks.add(TEST_NOTEBOOK); await db.notebooks .notebook(nbId) .topics.topic("General") diff --git a/packages/core/__tests__/utils/index.js b/packages/core/__tests__/utils/index.js index a1f2e2e27..8cf843694 100644 --- a/packages/core/__tests__/utils/index.js +++ b/packages/core/__tests__/utils/index.js @@ -26,7 +26,10 @@ const notebookTest = (notebook = TEST_NOTEBOOK) => }); var TEST_NOTE = { - content: { delta: "I am a delta", text: "I am a text" } + content: { + delta: { ops: [{ type: "insert", text: "I am a delta" }] }, + text: "I am a text" + } }; const LONG_TEXT =