Skip to content

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

core: fix warnings in tests

Abdullah Attaebf98bc65207
diff --git a/packages/core/__tests__/notes.test.ts b/packages/core/__tests__/notes.test.ts
index fde8728a8..011d77fd4 100644
--- a/packages/core/__tests__/notes.test.ts
+++ b/packages/core/__tests__/notes.test.ts
@@ -60,13 +60,13 @@ test("add invalid note", () =>
databaseTest().then(async (db) => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
- expect(db.notes.add()).rejects.toThrow();
+ await expect(db.notes.add()).rejects.toThrow();
- expect(db.notes.add({})).rejects.toThrow();
+ await expect(db.notes.add({})).rejects.toThrow();
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
- expect(db.notes.add({ hello: "world" })).rejects.toThrow();
+ await expect(db.notes.add({ hello: "world" })).rejects.toThrow();
}));
test("add note", () =>
diff --git a/packages/core/__tests__/utils/index.ts b/packages/core/__tests__/utils/index.ts
index dc7c4d84e..e718640ee 100644
--- a/packages/core/__tests__/utils/index.ts
+++ b/packages/core/__tests__/utils/index.ts
@@ -31,6 +31,7 @@ import { tmpdir } from "os";
import { getId } from "../../src/utils/id.js";
import { existsSync, mkdirSync } from "fs";
import * as betterTrigram from "sqlite-better-trigram";
+import * as fts5Html from "sqlite3-fts5-html";
const TEST_NOTEBOOK: Partial<Notebook> = {
title: "Test Notebook",
@@ -65,6 +66,7 @@ function databaseTest(type: "memory" | "persistent" = "memory") {
batchSize: 500
});
betterTrigram.load(betterSqliteDb);
+ fts5Html.load(betterSqliteDb);
return db.init().then(() => db);
}
diff --git a/packages/core/__tests__/vault.test.js b/packages/core/__tests__/vault.test.js
index ee92021d1..eaac8e847 100644
--- a/packages/core/__tests__/vault.test.js
+++ b/packages/core/__tests__/vault.test.js
@@ -34,12 +34,12 @@ test("create vault", () =>
test("lock vault", () =>
databaseTest().then(async (db) => {
await expect(db.vault.create("password")).resolves.toBe(true);
- expect(db.vault.lock()).resolves.toBe(true);
+ await expect(db.vault.lock()).resolves.toBe(true);
}));
test("lock non-existent vault", () =>
databaseTest().then(async (db) => {
- expect(db.vault.lock()).resolves.toBe(true);
+ await expect(db.vault.lock()).resolves.toBe(true);
}));
test("unlock vault", () =>