1
0
Fork 0

Merge branch 'tests' into 'master'

Fix config missing on test

See merge request LETU/LETU!4
This commit is contained in:
Ethanell 2020-10-12 21:37:06 +02:00
commit 09f2d9cf37
3 changed files with 6 additions and 4 deletions

7
app.js
View file

@ -5,18 +5,21 @@ let cookieParser = require("cookie-parser");
let logger = require("morgan");
let sassMiddleware = require("node-sass-middleware");
const session = require("express-session");
const config = require("./config/config.json");
let config = process.env.NODE_ENV === "test" ? {} : require("./config/config.json");
let indexRouter = require("./routes/index");
const loginRouter = require("./routes/login");
let app = express();
const sessionMiddleware = session({secret: config.secret});
const sessionMiddleware = session({
secret: process.env.NODE_ENV === "test" ? "Keyboard Cat" : config.secret
});
// view engine setup
app.set("views", path.join(__dirname, "views"));
app.set("view engine", "pug");
app.set("sessionMiddleware", sessionMiddleware);
app.set("config", config);
app.use(logger("dev"));
app.use(express.json());

View file

@ -4,7 +4,6 @@ const fs = require("fs");
const path = require("path");
const Sequelize = require("sequelize");
const basename = path.basename(__filename);
const config = require(__dirname + "/../config/config.json")["database"];
const db = {};
let sequelize;

View file

@ -1,7 +1,7 @@
"use strict";
const crypto = require("crypto");
const privateKey = require("../config/config.json").passwordPrivateKey;
const privateKey = process.env.NODE_ENV === "test" ? require("../config/config_example.json") : require("../config/config.json").passwordPrivateKey;
const {
Model