core: fix tests

This commit is contained in:
ammarahm-ed
2023-06-10 12:36:14 +05:00
committed by Abdullah Atta
parent 561d7a8bbc
commit fa7900aef6
3 changed files with 8 additions and 4 deletions

View File

@@ -22,7 +22,8 @@ import StorageInterface from "../__mocks__/storage.mock";
import { login } from "./utils";
test("refresh token concurrently", async () => {
const db = new DB(StorageInterface);
const db = new DB();
db.setup(StorageInterface);
await db.init();
await expect(login(db)).resolves.not.toThrow();
@@ -41,7 +42,8 @@ test("refresh token concurrently", async () => {
}, 30000);
test("refresh token using the same refresh_token multiple time", async () => {
const db = new DB(StorageInterface);
const db = new DB();
db.setup(StorageInterface);
await db.init();
await expect(login(db)).resolves.not.toThrow();

View File

@@ -22,7 +22,8 @@ import Constants from "../utils/constants";
import StorageInterface from "../__mocks__/storage.mock";
test("db.host should change HOST", () => {
const db = new DB(StorageInterface);
const db = new DB();
db.setup(StorageInterface);
db.host({ API_HOST: "hello world" });
expect(Constants.API_HOST).toBe("hello world");
});

View File

@@ -37,7 +37,8 @@ const TEST_NOTEBOOK2 = {
};
function databaseTest() {
let db = new DB(StorageInterface, null, FS, Compressor);
let db = new DB();
db.setup(StorageInterface, null, FS, Compressor);
return db.init().then(() => db);
}