mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 07:07:35 +01:00
allow admins to manipulate time on test servers
This commit is contained in:
committed by
Sabe Jones
parent
1b12e9d8b7
commit
593524905e
@@ -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')}`);
|
||||
|
||||
Reference in New Issue
Block a user