mirror of
https://github.com/wassname/talk.git
synced 2026-06-29 03:21:58 +08:00
b0f01cf00f
* Initial commit of asset queuing * Addresssing comments
44 lines
1.5 KiB
JavaScript
44 lines
1.5 KiB
JavaScript
const Setting = require('../../models/setting');
|
|
const expect = require('chai').expect;
|
|
|
|
describe('Setting: model', () => {
|
|
|
|
beforeEach(() => {
|
|
const defaults = {id: 1};
|
|
return Setting.update({id: '1'}, {$setOnInsert: defaults}, {upsert: true});
|
|
});
|
|
|
|
describe('#getSettings()', () => {
|
|
it('should have a moderation field defined', () => {
|
|
return Setting.getSettings().then(settings => {
|
|
expect(settings).to.have.property('moderation').and.to.equal('pre');
|
|
});
|
|
});
|
|
it('should have two infoBox fields defined', () => {
|
|
return Setting.getSettings().then(settings => {
|
|
expect(settings).to.have.property('infoBoxEnable').and.to.equal(false);
|
|
expect(settings).to.have.property('infoBoxContent').and.to.equal('');
|
|
});
|
|
});
|
|
});
|
|
|
|
describe('#updateSettings()', () => {
|
|
it('should update the settings with a passed object', () => {
|
|
const mockSettings = {moderation: 'post', infoBoxEnable: true, infoBoxContent: 'yeah'};
|
|
return Setting.updateSettings(mockSettings).then(updatedSettings => {
|
|
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('#getModerationSetting', () => {
|
|
it('should return the moderation settings', () => {
|
|
return Setting.getModerationSetting().then(({moderation}) => {
|
|
expect(moderation).not.to.be.null;
|
|
});
|
|
});
|
|
});
|
|
});
|