mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-22 22:49:45 +01:00
fix: do not get undefined items
This commit is contained in:
@@ -4,10 +4,16 @@ import {
|
|||||||
notebookTest,
|
notebookTest,
|
||||||
TEST_NOTE,
|
TEST_NOTE,
|
||||||
TEST_NOTEBOOK,
|
TEST_NOTEBOOK,
|
||||||
|
databaseTest,
|
||||||
} from "./utils";
|
} from "./utils";
|
||||||
|
|
||||||
beforeEach(() => StorageInterface.clear());
|
beforeEach(() => StorageInterface.clear());
|
||||||
|
|
||||||
|
test("trash should be empty", () =>
|
||||||
|
databaseTest().then((db) => {
|
||||||
|
expect(db.trash.all.length).toBe(0);
|
||||||
|
}));
|
||||||
|
|
||||||
test("permanently delete a note", () =>
|
test("permanently delete a note", () =>
|
||||||
noteTest().then(async ({ db, id }) => {
|
noteTest().then(async ({ db, id }) => {
|
||||||
const note = db.notes.note(id);
|
const note = db.notes.note(id);
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ export default class CachedCollection {
|
|||||||
getAllItems(sortFn = (u) => u.dateCreated) {
|
getAllItems(sortFn = (u) => u.dateCreated) {
|
||||||
let items = [];
|
let items = [];
|
||||||
this.map.forEach((value) => {
|
this.map.forEach((value) => {
|
||||||
if (value.deleted) return;
|
if (!value || value.deleted) return;
|
||||||
items[items.length] = value;
|
items[items.length] = value;
|
||||||
});
|
});
|
||||||
return sort(items).desc(sortFn);
|
return sort(items).desc(sortFn);
|
||||||
|
|||||||
Reference in New Issue
Block a user