allow admins to manipulate time on test servers

This commit is contained in:
Phillip Thelen
2024-02-15 13:09:46 +01:00
committed by Sabe Jones
parent 1b12e9d8b7
commit 593524905e
6 changed files with 109 additions and 37 deletions

View File

@@ -2,7 +2,6 @@ import nconf from 'nconf';
import express from 'express';
import http from 'http';
import logger from './libs/logger';
import sinon from 'sinon';
// Setup translations
// Must come before attach middlewares so Mongoose validations can use translations
@@ -26,23 +25,6 @@ app.set('port', nconf.get('PORT'));
attachMiddlewares(app, server);
const time = new Date(2024, 2, 18);
const clock = sinon.useFakeTimers({
now: time,
shouldAdvanceTime: true,
});
var jumped = false;
setInterval(() => {
if (jumped) {
jumped = false;
return;
}
jumped = true;
console.log('Jumping time');
clock.jump(36000);
}, 1000);
server.on('request', app);
server.listen(app.get('port'), () => {
logger.info(`Express server listening on port ${app.get('port')}`);