Fix test for CI

This commit is contained in:
vjrj 2018-04-12 20:54:34 +02:00
parent 8941d6e54e
commit 1360f742f3
4 changed files with 9 additions and 3 deletions

View file

@ -5,6 +5,10 @@
import { chai } from 'meteor/practicalmeteor:chai';
import SiteSettings from '/imports/api/SiteSettings/SiteSettings';
import SiteSettingsTypes from '/imports/api/SiteSettings/SiteSettingsTypes';
import { resetDatabase } from 'meteor/xolvio:cleaner';
resetDatabase('siteSettings');
SiteSettings._ensureIndex({ name: 1 }, { unique: 1 });
const setting = {
name: 'site-test',
@ -35,12 +39,12 @@ describe('site settings store', () => {
chai.expect(SiteSettings.find({ _id: inserted }).count()).equal(0);
});
it('should not insert twice', () => {
it('should not be inserted twice', () => {
const id = SiteSettings.insert(setting);
// If this fails manual check that the setting it's not already in the db.
chai.expect(() => {
SiteSettings.insert(setting);
}).to.throw('E11000 duplicate key error collection: fuegos.siteSettings index: name_1 dup key: { : "site-test" }');
}).to.throw();
const inserted = SiteSettings.find(id).count();
chai.expect(inserted).equal(1);
SiteSettings.remove(id);