mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-02-24 04:00:59 +01:00
core: add more lookup tests
This commit is contained in:
@@ -17,7 +17,13 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { noteTest, TEST_NOTE, notebookTest, TEST_NOTEBOOK2 } from "./utils";
|
||||
import {
|
||||
noteTest,
|
||||
TEST_NOTE,
|
||||
notebookTest,
|
||||
TEST_NOTEBOOK2,
|
||||
databaseTest
|
||||
} from "./utils";
|
||||
import { test, expect } from "vitest";
|
||||
|
||||
const content = {
|
||||
@@ -64,3 +70,28 @@ test("search notebooks", () =>
|
||||
let filtered = await db.lookup.notebooks("Description").ids();
|
||||
expect(filtered.length).toBeGreaterThan(0);
|
||||
}));
|
||||
|
||||
test("search should not return trashed notes", () =>
|
||||
databaseTest().then(async (db) => {
|
||||
const id = await db.notes.add({
|
||||
title: "world is a heavy tune"
|
||||
});
|
||||
await db.notes.moveToTrash(id);
|
||||
|
||||
const filtered = await db.lookup.notes("heavy tune").ids();
|
||||
|
||||
expect(filtered).toHaveLength(0);
|
||||
}));
|
||||
|
||||
test("search should return restored notes", () =>
|
||||
databaseTest().then(async (db) => {
|
||||
const id = await db.notes.add({
|
||||
title: "world is a heavy tune"
|
||||
});
|
||||
await db.notes.moveToTrash(id);
|
||||
await db.trash.restore(id);
|
||||
|
||||
const filtered = await db.lookup.notes("heavy tune").ids();
|
||||
|
||||
expect(filtered).toHaveLength(1);
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user