mirror of
https://github.com/wassname/talk.git
synced 2026-08-17 11:27:52 +08:00
replaced eslint:recommended with prettier
This commit is contained in:
@@ -8,19 +8,18 @@ chai.use(require('chai-http'));
|
||||
const expect = chai.expect;
|
||||
|
||||
const SettingsService = require('../../../../../services/settings');
|
||||
const defaults = {id: '1', moderation: 'PRE'};
|
||||
const defaults = { id: '1', moderation: 'PRE' };
|
||||
|
||||
describe('/api/v1/settings', () => {
|
||||
|
||||
beforeEach(() => SettingsService.init(defaults));
|
||||
|
||||
describe('#get', () => {
|
||||
|
||||
it('should return a settings object', async () => {
|
||||
for (let role of ['ADMIN', 'MODERATOR']) {
|
||||
const res = await chai.request(app)
|
||||
const res = await chai
|
||||
.request(app)
|
||||
.get('/api/v1/settings')
|
||||
.set(passport.inject({role}));
|
||||
.set(passport.inject({ role }));
|
||||
expect(res).to.have.status(200);
|
||||
expect(res).to.be.json;
|
||||
expect(res.body).to.have.property('moderation', 'PRE');
|
||||
@@ -29,29 +28,29 @@ describe('/api/v1/settings', () => {
|
||||
});
|
||||
|
||||
describe('#put', () => {
|
||||
|
||||
it('should update the settings', () => {
|
||||
return chai.request(app)
|
||||
return chai
|
||||
.request(app)
|
||||
.put('/api/v1/settings')
|
||||
.set(passport.inject({role: 'ADMIN'}))
|
||||
.send({moderation: 'POST'})
|
||||
.then((res) => {
|
||||
.set(passport.inject({ role: 'ADMIN' }))
|
||||
.send({ moderation: 'POST' })
|
||||
.then(res => {
|
||||
expect(res).to.have.status(204);
|
||||
|
||||
return SettingsService.retrieve();
|
||||
})
|
||||
.then((settings) => {
|
||||
.then(settings => {
|
||||
expect(settings).to.have.property('moderation', 'POST');
|
||||
});
|
||||
});
|
||||
|
||||
it('should require ADMIN role', () => {
|
||||
const promise = chai.request(app)
|
||||
const promise = chai
|
||||
.request(app)
|
||||
.put('/api/v1/settings')
|
||||
.set(passport.inject({role: 'MODERATOR'}))
|
||||
.send({moderation: 'POST'});
|
||||
.set(passport.inject({ role: 'MODERATOR' }))
|
||||
.send({ moderation: 'POST' });
|
||||
return expect(promise).to.eventually.be.rejected;
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user