Skip to content

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

test: add merge notebook test

thecodrra4274eb75f5b
diff --git a/packages/core/__tests__/notebooks.test.js b/packages/core/__tests__/notebooks.test.js
index bad13f8b2..e0edbe00f 100644
--- a/packages/core/__tests__/notebooks.test.js
+++ b/packages/core/__tests__/notebooks.test.js
@@ -134,6 +134,23 @@ test("merge notebook when local notebook is also edited should merge noteIds too
expect(notebook.topics.all[0].notes.length).toBe(2);
}));
+test("merging notebook when local notebook is not edited should not update remote notebook dateEdited", () =>
+ notebookTest().then(async ({ db, id }) => {
+ let notebook = db.notebooks.notebook(id);
+
+ let note = await db.notes.add(TEST_NOTE);
+ await db.notes.move(
+ { id: notebook.data.id, topic: notebook.data.topics[0].id },
+ note
+ );
+
+ const newNotebook = { ...notebook.data, remote: true };
+
+ await expect(db.notebooks.merge(newNotebook)).resolves.not.toThrow();
+
+ expect(db.notebooks.notebook(id).dateEdited).toBe(newNotebook.dateEdited);
+ }));
+
test("merge notebook with topic removed that is edited in the local notebook", () =>
notebookTest().then(async ({ db, id }) => {
let notebook = db.notebooks.notebook(id);
diff --git a/packages/core/__tests__/trash.test.js b/packages/core/__tests__/trash.test.js
index e9efbfd69..084ec3b9c 100644
--- a/packages/core/__tests__/trash.test.js
+++ b/packages/core/__tests__/trash.test.js
@@ -95,7 +95,7 @@ test("delete a notebook", () =>
expect(db.notes.note(noteId).notebook).toBeUndefined();
}));
-test.only("restore a deleted notebook", () =>
+test("restore a deleted notebook", () =>
notebookTest().then(async ({ db, id }) => {
let noteId = await db.notes.add(TEST_NOTE);
await db.notebooks.notebook(id).topics.topic("hello").add(noteId);