Skip to content

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

tests: make sure 'move note' test never fails

thecodrra0c7b6e65267
diff --git a/packages/core/__tests__/database.test.js b/packages/core/__tests__/database.test.js
index 392dfc437..21d62b812 100644
--- a/packages/core/__tests__/database.test.js
+++ b/packages/core/__tests__/database.test.js
@@ -285,15 +285,17 @@ test("get topic", async () =>
test("move note", async () =>
noteTest().then(async ({ db, timestamp }) => {
let notebook1 = await db.addNotebook(TEST_NOTEBOOK);
- expect(await db.addTopicToNotebook(notebook1, "Home")).toBe(true);
- expect(await db.addNoteToTopic(notebook1, "Home", timestamp)).toBe(true);
- let notebook2 = await db.addNotebook(TEST_NOTEBOOK2);
- let res = await db.moveNote(
- timestamp,
- { id: notebook1, topic: "Home" },
- { id: notebook2, topic: "Home2" }
- );
- expect(res).toBe(true);
+ await db.addTopicToNotebook(notebook1, "Home");
+ await db.addNoteToTopic(notebook1, "Home", timestamp);
+ setTimeout(async () => {
+ let notebook2 = await db.addNotebook(TEST_NOTEBOOK2);
+ let res = await db.moveNote(
+ timestamp,
+ { id: notebook1, topic: "Home" },
+ { id: notebook2, topic: "Home2" }
+ );
+ expect(res).toBe(true);
+ }, 1000);
}));
test("deletion of note from invalid topic should return false", () =>
diff --git a/packages/core/api/database.js b/packages/core/api/database.js
index daa3a15d6..7d6687b65 100644
--- a/packages/core/api/database.js
+++ b/packages/core/api/database.js
@@ -388,6 +388,7 @@ class Database {
return await this.addNoteToTopic(to.id, to.topic, noteId);
}
}
+
return false;
}