sqlite: don't hardcode version test

This commit is contained in:
Reto Brunner 2022-12-28 13:52:24 +01:00
parent 25642fbe98
commit 063aca948c
2 changed files with 3 additions and 6 deletions

View File

@ -23,7 +23,7 @@ try {
); );
} }
const currentSchemaVersion = 1520239200; export const currentSchemaVersion = 1520239200;
const schema = [ const schema = [
// Schema version #1 // Schema version #1

View File

@ -5,7 +5,7 @@ import {expect} from "chai";
import util from "../util"; import util from "../util";
import Msg, {MessageType} from "../../server/models/msg"; import Msg, {MessageType} from "../../server/models/msg";
import Config from "../../server/config"; import Config from "../../server/config";
import MessageStorage from "../../server/plugins/messageStorage/sqlite"; import MessageStorage, {currentSchemaVersion} from "../../server/plugins/messageStorage/sqlite";
describe("SQLite Message Storage", function () { describe("SQLite Message Storage", function () {
// Increase timeout due to unpredictable I/O on CI services // Increase timeout due to unpredictable I/O on CI services
@ -53,11 +53,8 @@ describe("SQLite Message Storage", function () {
"SELECT value FROM options WHERE name = 'schema_version'", "SELECT value FROM options WHERE name = 'schema_version'",
(err, row) => { (err, row) => {
expect(err).to.be.null; expect(err).to.be.null;
// Should be sqlite.currentSchemaVersion,
// compared as string because it's returned as such from the database // compared as string because it's returned as such from the database
expect(row.value).to.equal("1520239200"); expect(row.value).to.equal(currentSchemaVersion.toString());
done(); done();
} }
); );