mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-10-30 20:52:29 +01:00
36 lines
778 B
JavaScript
36 lines
778 B
JavaScript
import nconf from 'nconf';
|
|
import {
|
|
generateUser,
|
|
} from '../../../../helpers/api-integration/v3';
|
|
|
|
describe('POST /debug/make-admin', () => {
|
|
let user;
|
|
|
|
before(async () => {
|
|
user = await generateUser();
|
|
});
|
|
|
|
afterEach(() => {
|
|
nconf.set('IS_PROD', false);
|
|
});
|
|
|
|
it('makes user an admin', async () => {
|
|
await user.post('/debug/make-admin');
|
|
|
|
await user.sync();
|
|
|
|
expect(user.permissions.fullAccess).to.eql(true);
|
|
});
|
|
|
|
it('returns error when not in production mode', async () => {
|
|
sandbox.stub(nconf, 'get').withArgs('IS_PROD').returns(true);
|
|
|
|
await expect(user.post('/debug/make-admin'))
|
|
.eventually.be.rejected.and.to.deep.equal({
|
|
code: 404,
|
|
error: 'NotFound',
|
|
message: 'Not found.',
|
|
});
|
|
});
|
|
});
|