mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-22 22:49:45 +01:00
feat: add get favorites
This commit is contained in:
@@ -80,6 +80,11 @@ test("update note", async () => {
|
||||
expect(note.colors).toStrictEqual(["red", "blue"]);
|
||||
});
|
||||
|
||||
test("get favorites", () => {
|
||||
let favorites = db.getFavorites();
|
||||
expect(favorites.length).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
test("note with text longer than 150 characters should have ... in the headline", () => {
|
||||
let note = db.getNote(TEST_NOTE.dateCreated);
|
||||
expect(note.headline.includes("...")).toBe(true);
|
||||
|
||||
@@ -55,6 +55,10 @@ class Database {
|
||||
return extractValues(this.notes).reverse();
|
||||
}
|
||||
|
||||
getFavorites() {
|
||||
return tfun.filter(".favorite = true")(extractValues(this.notes));
|
||||
}
|
||||
|
||||
/**
|
||||
* Group notes by given criteria
|
||||
* @param {string} by One from 'abc', 'month', 'year' or 'week'. Leave it empty for default grouping.
|
||||
|
||||
Reference in New Issue
Block a user