From 3acf783d948ebb1907da875ef87b0da9ef2309ff Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Sun, 1 Jan 2023 23:23:57 +0100 Subject: Began adding tests --- middlewares/sessions.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'middlewares/sessions.js') diff --git a/middlewares/sessions.js b/middlewares/sessions.js index 8697ae0..901c262 100644 --- a/middlewares/sessions.js +++ b/middlewares/sessions.js @@ -1,9 +1,12 @@ import expressSession from "express-session"; -import sqlite from "better-sqlite3"; +import Database from "better-sqlite3"; import sqliteStore from "better-sqlite3-session-store"; const SqliteStore = sqliteStore(expressSession); -const db = new sqlite("sessions.db", process.env.NODE_ENV === "production" ? null : { verbose: console.log }); +const db = new Database( + process.env.NODE_ENV === "test" ? "testsessions.db" : "sessions.db", + process.env.NODE_ENV === "development" ? { verbose: console.log } : null +); const secret = process.env.SESSION_SECRET || "secret"; const session = expressSession({ cookie: { -- cgit v1.2.3