mirror of
https://github.com/wassname/talk.git
synced 2026-08-12 12:30:39 +08:00
Fixer pre/post
This commit is contained in:
@@ -20,7 +20,7 @@ module.exports = {
|
||||
},
|
||||
'User registers and posts a comment with premod off': client => {
|
||||
client.perform((client, done) => {
|
||||
mocks.settings({moderation: 'post'})
|
||||
mocks.settings({moderation: 'POST'})
|
||||
.then(() => {
|
||||
|
||||
// Load Page
|
||||
@@ -61,7 +61,7 @@ module.exports = {
|
||||
},
|
||||
'User posts a comment with premod on': client => {
|
||||
client.perform((client, done) => {
|
||||
mocks.settings({moderation: 'pre'})
|
||||
mocks.settings({moderation: 'PRE'})
|
||||
.then(() => {
|
||||
|
||||
// Load Page
|
||||
@@ -86,7 +86,7 @@ module.exports = {
|
||||
},
|
||||
'User replies to a comment with premod off': client => {
|
||||
client.perform((client, done) => {
|
||||
mocks.settings({moderation: 'post'})
|
||||
mocks.settings({moderation: 'POST'})
|
||||
.then(() => {
|
||||
|
||||
// Load Page
|
||||
@@ -119,7 +119,7 @@ module.exports = {
|
||||
},
|
||||
'User replies to a comment with premod on': client => {
|
||||
client.perform((client, done) => {
|
||||
mocks.settings({moderation: 'pre'})
|
||||
mocks.settings({moderation: 'PRE'})
|
||||
|
||||
// Add a mock user
|
||||
.then(() => {
|
||||
|
||||
@@ -15,7 +15,7 @@ const CommentsService = require('../../../../services/comments');
|
||||
const UsersService = require('../../../../services/users');
|
||||
const SettingsService = require('../../../../services/settings');
|
||||
|
||||
const settings = {id: '1', moderation: 'pre', wordlist: {banned: ['bad words'], suspect: ['suspect words']}};
|
||||
const settings = {id: '1', moderation: 'PRE', wordlist: {banned: ['bad words'], suspect: ['suspect words']}};
|
||||
|
||||
describe('/api/v1/comments', () => {
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ const Action = require('../../../../models/action');
|
||||
const UsersService = require('../../../../services/users');
|
||||
|
||||
const SettingsService = require('../../../../services/settings');
|
||||
const settings = {id: '1', moderation: 'pre', wordlist: {banned: ['banned'], suspect: ['suspect']}};
|
||||
const settings = {id: '1', moderation: 'PRE', wordlist: {banned: ['banned'], suspect: ['suspect']}};
|
||||
|
||||
describe('/api/v1/queue', () => {
|
||||
const comments = [{
|
||||
|
||||
@@ -8,7 +8,7 @@ chai.should();
|
||||
chai.use(require('chai-http'));
|
||||
|
||||
const SettingsService = require('../../../../services/settings');
|
||||
const defaults = {id: '1', moderation: 'pre'};
|
||||
const defaults = {id: '1', moderation: 'PRE'};
|
||||
|
||||
describe('/api/v1/settings', () => {
|
||||
|
||||
@@ -25,7 +25,7 @@ describe('/api/v1/settings', () => {
|
||||
.then((res) => {
|
||||
expect(res).to.have.status(200);
|
||||
expect(res).to.be.json;
|
||||
expect(res.body).to.have.property('moderation', 'pre');
|
||||
expect(res.body).to.have.property('moderation', 'PRE');
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -36,14 +36,14 @@ describe('/api/v1/settings', () => {
|
||||
return chai.request(app)
|
||||
.put('/api/v1/settings')
|
||||
.set(passport.inject({roles: ['ADMIN']}))
|
||||
.send({moderation: 'post'})
|
||||
.send({moderation: 'POST'})
|
||||
.then((res) => {
|
||||
expect(res).to.have.status(204);
|
||||
|
||||
return SettingsService.retrieve();
|
||||
})
|
||||
.then((settings) => {
|
||||
expect(settings).to.have.property('moderation', 'post');
|
||||
expect(settings).to.have.property('moderation', 'POST');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -6,7 +6,7 @@ const chai = require('chai');
|
||||
const expect = chai.expect;
|
||||
|
||||
const SettingsService = require('../../../../services/settings');
|
||||
const settings = {id: '1', moderation: 'pre', wordlist: {banned: ['bad words'], suspect: ['suspect words']}};
|
||||
const settings = {id: '1', moderation: 'PRE', wordlist: {banned: ['bad words'], suspect: ['suspect words']}};
|
||||
|
||||
// Setup chai.
|
||||
chai.should();
|
||||
|
||||
@@ -72,7 +72,7 @@ describe('services.AssetsService', () => {
|
||||
expect(asset).to.have.property('settings');
|
||||
expect(asset.settings).to.be.null;
|
||||
|
||||
return AssetsService.overrideSettings(asset.id, {moderation: 'pre'});
|
||||
return AssetsService.overrideSettings(asset.id, {moderation: 'PRE'});
|
||||
})
|
||||
.then(() => {
|
||||
return AssetsService.findOrCreateByUrl('https://override.test.com/asset');
|
||||
@@ -80,7 +80,7 @@ describe('services.AssetsService', () => {
|
||||
.then((asset) => {
|
||||
expect(asset).to.have.property('settings');
|
||||
expect(asset.settings).is.an('object');
|
||||
expect(asset.settings).to.have.property('moderation', 'pre');
|
||||
expect(asset.settings).to.have.property('moderation', 'PRE');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -6,7 +6,7 @@ const UsersService = require('../../services/users');
|
||||
const SettingsService = require('../../services/settings');
|
||||
const CommentsService = require('../../services/comments');
|
||||
|
||||
const settings = {id: '1', moderation: 'pre', wordlist: {banned: ['bad words'], suspect: ['suspect words']}};
|
||||
const settings = {id: '1', moderation: 'PRE', wordlist: {banned: ['bad words'], suspect: ['suspect words']}};
|
||||
|
||||
const expect = require('chai').expect;
|
||||
|
||||
|
||||
@@ -3,12 +3,12 @@ const expect = require('chai').expect;
|
||||
|
||||
describe('services.SettingsService', () => {
|
||||
|
||||
beforeEach(() => SettingsService.init({moderation: 'pre', wordlist: ['donut']}));
|
||||
beforeEach(() => SettingsService.init({moderation: 'PRE', wordlist: ['donut']}));
|
||||
|
||||
describe('#retrieve()', () => {
|
||||
it('should have a moderation field defined', () => {
|
||||
return SettingsService.retrieve().then(settings => {
|
||||
expect(settings).to.have.property('moderation').and.to.equal('pre');
|
||||
expect(settings).to.have.property('moderation').and.to.equal('PRE');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -22,10 +22,10 @@ describe('services.SettingsService', () => {
|
||||
|
||||
describe('#update()', () => {
|
||||
it('should update the settings with a passed object', () => {
|
||||
const mockSettings = {moderation: 'post', infoBoxEnable: true, infoBoxContent: 'yeah'};
|
||||
const mockSettings = {moderation: 'POST', infoBoxEnable: true, infoBoxContent: 'yeah'};
|
||||
return SettingsService.update(mockSettings).then(updatedSettings => {
|
||||
expect(updatedSettings).to.be.an('object');
|
||||
expect(updatedSettings).to.have.property('moderation').and.to.equal('post');
|
||||
expect(updatedSettings).to.have.property('moderation').and.to.equal('POST');
|
||||
expect(updatedSettings).to.have.property('infoBoxEnable', true);
|
||||
expect(updatedSettings).to.have.property('infoBoxContent', 'yeah');
|
||||
});
|
||||
@@ -45,11 +45,11 @@ describe('services.SettingsService', () => {
|
||||
return SettingsService
|
||||
.retrieve()
|
||||
.then((settings) => {
|
||||
let ovrSett = {moderation: 'post'};
|
||||
let ovrSett = {moderation: 'POST'};
|
||||
|
||||
settings.merge(ovrSett);
|
||||
|
||||
expect(settings).to.have.property('moderation', 'post');
|
||||
expect(settings).to.have.property('moderation', 'POST');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -7,7 +7,7 @@ describe('services.UsersService', () => {
|
||||
|
||||
let mockUsers;
|
||||
beforeEach(() => {
|
||||
const settings = {id: '1', moderation: 'pre', wordlist: {banned: ['bad words'], suspect: ['suspect words']}};
|
||||
const settings = {id: '1', moderation: 'PRE', wordlist: {banned: ['bad words'], suspect: ['suspect words']}};
|
||||
|
||||
return SettingsService.init(settings).then(() => {
|
||||
return UsersService.createLocalUsers([{
|
||||
|
||||
@@ -17,7 +17,7 @@ describe('services.Wordlist', () => {
|
||||
};
|
||||
|
||||
let wordlist = new Wordlist();
|
||||
const settings = {id: '1', moderation: 'pre', wordlist: {banned: ['bad words'], suspect: ['suspect words']}};
|
||||
const settings = {id: '1', moderation: 'PRE', wordlist: {banned: ['bad words'], suspect: ['suspect words']}};
|
||||
|
||||
beforeEach(() => SettingsService.init(settings));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user