From 063aca948ccd6aa99163ae4dbf922d8b069eaf60 Mon Sep 17 00:00:00 2001 From: Reto Brunner Date: Wed, 28 Dec 2022 13:52:24 +0100 Subject: [PATCH] sqlite: don't hardcode version test --- server/plugins/messageStorage/sqlite.ts | 2 +- test/plugins/sqlite.ts | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/server/plugins/messageStorage/sqlite.ts b/server/plugins/messageStorage/sqlite.ts index 7441687d..9f3766fd 100644 --- a/server/plugins/messageStorage/sqlite.ts +++ b/server/plugins/messageStorage/sqlite.ts @@ -23,7 +23,7 @@ try { ); } -const currentSchemaVersion = 1520239200; +export const currentSchemaVersion = 1520239200; const schema = [ // Schema version #1 diff --git a/test/plugins/sqlite.ts b/test/plugins/sqlite.ts index a3c939e7..5f0d8b0a 100644 --- a/test/plugins/sqlite.ts +++ b/test/plugins/sqlite.ts @@ -5,7 +5,7 @@ import {expect} from "chai"; import util from "../util"; import Msg, {MessageType} from "../../server/models/msg"; 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 () { // 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'", (err, row) => { expect(err).to.be.null; - - // Should be sqlite.currentSchemaVersion, // 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(); } );