fix tests

This commit is contained in:
Phillip Thelen
2024-04-26 13:44:51 +02:00
parent 99a7b90247
commit d6cabeedb4
7 changed files with 32 additions and 15 deletions
@@ -20,15 +20,11 @@ describe('GET /debug/time-travel-time', () => {
await user.post('/debug/jump-time', { disable: true });
});
it('returns error when the user is not an admin', async () => {
it('returns shifted when the user is not an admin', async () => {
nconf.set('ENABLE_TIME_TRAVEL', true);
const regularUser = await generateUser();
await expect(regularUser.get('/debug/time-travel-time'))
.eventually.be.rejected.and.to.deep.equal({
code: 400,
error: 'BadRequest',
message: 'You do not have permission to time travel.',
});
const result = await regularUser.get('/debug/time-travel-time');
expect(result.time).to.exist;
});
it('returns error when not in time travel mode', async () => {
@@ -17,9 +17,5 @@ describe('GET /shops/backgrounds', () => {
expect(shop.notes).to.eql(t('backgroundShop'));
expect(shop.imageName).to.equal('background_shop');
expect(shop.sets).to.be.an('array');
const sets = shop.sets.map(set => set.identifier);
expect(sets).to.include('incentiveBackgrounds');
expect(sets).to.include('backgrounds062014');
});
});
@@ -5,9 +5,15 @@ import {
describe('GET /shops/time-travelers', () => {
let user;
let clock;
beforeEach(async () => {
user = await generateUser();
clock = sinon.useFakeTimers(new Date('2024-06-08'));
});
afterEach(() => {
clock.restore();
});
it('returns a valid shop object', async () => {