A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
test: add test for note refs repairing
thecodrrd3d5a4829bd8
diff --git a/packages/core/__tests__/notes.test.js b/packages/core/__tests__/notes.test.jsindex ddabe5c4d..15c83acad 100644--- a/packages/core/__tests__/notes.test.js+++ b/packages/core/__tests__/notes.test.js@@ -263,15 +263,15 @@ test("export note to txt", () =>test("deleting a colored note should remove it from that color", () =>noteTest().then(async ({ db, id }) => {- await db.notes.note(id).color("Yellow");- let color = db.colors.tag("Yellow");+ await db.notes.note(id).color("yellow");+ let color = db.colors.tag("yellow");expect(color).toBeTruthy();expect(color.noteIds.indexOf(id)).toBeGreaterThan(-1);await db.notes.delete(id);- color = db.colors.tag("Yellow");+ color = db.colors.tag("yellow");expect(color).toBeFalsy();// TODO expect(color.noteIds.indexOf(id)).toBe(-1);}));@@ -339,3 +339,13 @@ test("repairing notebook references should reinclude the missing noteIds", () =>expect(notebook.topics.all[0].notes.length).toBe(0);expect(note.notebooks.length).toBe(0);}));++test("repairing notebook references should delete non-existent notebooks", () =>+ noteTest({+ ...TEST_NOTE,+ notebooks: [{ id: "hello", topics: ["helloworld"] }],+ }).then(async ({ db, id }) => {+ await db.notes.repairReferences();+ let note = db.notes.note(id);+ expect(note.notebooks.length).toBe(0);+ }));