This commit is contained in:
Phillip Thelen 2024-02-28 18:22:55 +01:00 committed by Sabe Jones
parent fb56f7df20
commit a50c0eb1e7
2 changed files with 6 additions and 6 deletions

View file

@ -5,8 +5,8 @@ import {
generateReq,
generateNext,
} from '../../../helpers/api-unit.helper';
import ensureDevelpmentMode from '../../../../website/server/middlewares/ensureDevelpmentMode';
import { NotFound } from '../../../../website/server/libs/errors';
import ensureTimeTravelMode from '../../../../website/server/middlewares/ensureTimeTravelMode';
describe('timetravelMode middleware', () => {
let res; let req; let
@ -19,18 +19,18 @@ describe('timetravelMode middleware', () => {
});
it('returns not found when not in time travel mode', () => {
sandbox.stub(nconf, 'get').withArgs('ENABLE_TIME_TRAVEL').returns(true);
sandbox.stub(nconf, 'get').withArgs('ENABLE_TIME_TRAVEL').returns(false);
ensureDevelpmentMode(req, res, next);
ensureTimeTravelMode(req, res, next);
const calledWith = next.getCall(0).args;
expect(calledWith[0] instanceof NotFound).to.equal(true);
});
it('passes when in time travel mode', () => {
sandbox.stub(nconf, 'get').withArgs('ENABLE_TIME_TRAVEL').returns(false);
sandbox.stub(nconf, 'get').withArgs('ENABLE_TIME_TRAVEL').returns(true);
ensureDevelpmentMode(req, res, next);
ensureTimeTravelMode(req, res, next);
expect(next).to.be.calledOnce;
expect(next.args[0]).to.be.empty;

View file

@ -20,7 +20,7 @@ export function getCurrentEvent () {
const now = moment();
const currEvtKey = Object.keys(common.content.repeatingEvents).find(
evtKey => {
const event = common.content.repeatingEventsS[evtKey];
const event = common.content.repeatingEvents[evtKey];
const startDate = event.start.replace('1970', now.year());
const endDate = event.end.replace('1970', now.year());