fixed settings

This commit is contained in:
Wyatt Johnson
2018-05-07 17:16:52 -06:00
parent 7b0a7f7d9a
commit 15c3a96291
3 changed files with 26 additions and 24 deletions
+16 -3
View File
@@ -2,8 +2,13 @@ const Settings = require('../../../services/settings');
const chai = require('chai');
const expect = chai.expect;
describe('services.SettingsService', () => {
beforeEach(() => Settings.init({ moderation: 'PRE', wordlist: ['donut'] }));
describe('services.Settings', () => {
beforeEach(() =>
Settings.init({
moderation: 'PRE',
wordlist: { banned: ['bannedWord'], suspect: [] },
})
);
describe('#retrieve()', () => {
it('should have a moderation field defined', () => {
@@ -35,6 +40,14 @@ describe('services.SettingsService', () => {
expect(settings).to.not.have.property('wordlist');
});
});
it('should have a wordlist field defined and not moderation', () => {
return Settings.select('wordlist').then(settings => {
expect(settings).to.not.have.property('moderation');
expect(settings).to.have.property('wordlist');
expect(settings.wordlist).to.have.property('banned');
expect(settings.wordlist.banned).to.contain('bannedWord');
});
});
});
describe('#update()', () => {
@@ -65,7 +78,7 @@ describe('services.SettingsService', () => {
const settings = await Settings.retrieve();
settings.charCount = 500;
await Settings.update(settings.toObject());
await Settings.update(settings);
});
});