mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 07:37:25 +01:00
Renamed namespace to debug and added unit test for middleware
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import nconf from 'nconf';
|
||||
import {
|
||||
generateUser,
|
||||
} from '../../../../helpers/api-v3-integration.helper';
|
||||
|
||||
describe('POST /debug/add-hourglass', () => {
|
||||
let userToGetHourGlass;
|
||||
|
||||
before(async () => {
|
||||
userToGetHourGlass = await generateUser();
|
||||
});
|
||||
|
||||
after(() => {
|
||||
nconf.set('IS_PROD', false);
|
||||
});
|
||||
|
||||
it('adds Hourglass to the current user', async () => {
|
||||
await userToGetHourGlass.post('/debug/add-hourglass');
|
||||
|
||||
let userWithHourGlass = await userToGetHourGlass.get('/user');
|
||||
|
||||
expect(userWithHourGlass.purchased.plan.consecutive.trinkets).to.equal(1);
|
||||
});
|
||||
|
||||
it('returns error when not in production mode', async () => {
|
||||
nconf.set('IS_PROD', true);
|
||||
|
||||
await expect(userToGetHourGlass.post('/debug/add-hourglass'))
|
||||
.eventually.be.rejected.and.to.deep.equal({
|
||||
code: 404,
|
||||
error: 'NotFound',
|
||||
message: 'Not found.',
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user