Test for db file existance instead of creating a new one in password-restet.js (#4519)

Test for db file existance instead of creating a new one in `password-restet.js`
This commit is contained in:
Frank Elsinga 2024-03-06 13:03:07 +01:00 committed by GitHub
commit fdf562fe39
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -8,6 +8,7 @@ const User = require("../server/model/user");
const { io } = require("socket.io-client");
const { localWebSocketURL } = require("../server/config");
const args = require("args-parser")(process.argv);
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
@ -19,10 +20,10 @@ const main = async () => {
}
console.log("Connecting the database");
Database.initDataDir(args);
await Database.connect(false, false, true);
try {
Database.initDataDir(args);
await Database.connect(false, false, true);
// No need to actually reset the password for testing, just make sure no connection problem. It is ok for now.
if (!process.env.TEST_BACKEND) {
const user = await R.findOne("user");