2021-08-01 09:59:25 +02:00
|
|
|
import assert from "assert";
|
|
|
|
|
2021-09-23 00:52:35 +02:00
|
|
|
import { db, privateDB } from "../../src/databases/databases";
|
2020-10-17 20:56:54 +02:00
|
|
|
|
2021-07-12 08:43:46 +02:00
|
|
|
describe("dbUpgrade", () => {
|
|
|
|
it("Should update the database version when starting the application", async () => {
|
|
|
|
const dbVersion = (await db.prepare("get", "SELECT key, value FROM config where key = ?", ["version"])).value;
|
|
|
|
const privateVersion = (await privateDB.prepare("get", "SELECT key, value FROM config where key = ?", ["version"])).value;
|
2021-08-01 09:59:25 +02:00
|
|
|
|
|
|
|
assert(
|
|
|
|
dbVersion >= 1 && privateVersion >= 1,
|
|
|
|
`Versions are not at least 1. db is ${dbVersion}, private is ${privateVersion}`);
|
2020-10-17 20:56:54 +02:00
|
|
|
});
|
|
|
|
});
|