Files
talk/tests/models/setting.js
T
Wyatt Johnson 2f7f0249b2 Added status changing + history
- Status's for comments is now an array of objects
2016-12-05 11:28:27 -05:00

43 lines
1.5 KiB
JavaScript

const Setting = require('../../models/setting');
const expect = require('chai').expect;
describe('models.Setting', () => {
beforeEach(() => Setting.init({moderation: 'pre'}));
describe('#retrieve()', () => {
it('should have a moderation field defined', () => {
return Setting.retrieve().then(settings => {
expect(settings).to.have.property('moderation').and.to.equal('pre');
});
});
it('should have two infoBox fields defined', () => {
return Setting.retrieve().then(settings => {
expect(settings).to.have.property('infoBoxEnable').and.to.equal(false);
expect(settings).to.have.property('infoBoxContent').and.to.equal('');
});
});
});
describe('#update()', () => {
it('should update the settings with a passed object', () => {
const mockSettings = {moderation: 'post', infoBoxEnable: true, infoBoxContent: 'yeah'};
return Setting.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('infoBoxEnable', true);
expect(updatedSettings).to.have.property('infoBoxContent', 'yeah');
});
});
});
describe('#get', () => {
it('should return the moderation settings', () => {
return Setting.retrieve().then(({moderation}) => {
expect(moderation).not.to.be.null;
});
});
});
});