mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
feat: Separate out update-user into set-cron and make-admin debug routes
This commit is contained in:
35
test/api/v3/integration/debug/POST-debug_make-admin.test.js
Normal file
35
test/api/v3/integration/debug/POST-debug_make-admin.test.js
Normal file
@@ -0,0 +1,35 @@
|
||||
import nconf from 'nconf';
|
||||
import {
|
||||
generateUser,
|
||||
} from '../../../../helpers/api-v3-integration.helper';
|
||||
|
||||
describe('POST /debug/make-admin', () => {
|
||||
let user;
|
||||
|
||||
before(async () => {
|
||||
user = await generateUser();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
nconf.set('IS_PROD', false);
|
||||
});
|
||||
|
||||
it('makes user an admine', async () => {
|
||||
await user.post('/debug/make-admin');
|
||||
|
||||
await user.sync();
|
||||
|
||||
expect(user.contributor.admin).to.eql(true);
|
||||
});
|
||||
|
||||
it('returns error when not in production mode', async () => {
|
||||
nconf.set('IS_PROD', true);
|
||||
|
||||
await expect(user.post('/debug/make-admin'))
|
||||
.eventually.be.rejected.and.to.deep.equal({
|
||||
code: 404,
|
||||
error: 'NotFound',
|
||||
message: 'Not found.',
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user