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

@ -66,3 +66,4 @@ saucecode:timezoned-synced-cron
meteorhacks:kadira
meteorhacks:zones
nimble:restivus
xolvio:cleaner

View file

@ -154,3 +154,4 @@ url@1.2.0
vjrj:piwik@0.3.1
webapp@1.5.0
webapp-hashing@1.0.9
xolvio:cleaner@0.3.3

View file

@ -22,7 +22,7 @@ More platforms and services in the future...
We do tests via:
```
TEST_WATCH=1 MONGO_URL=mongodb://localhost:27017/fuegos meteor --settings settings-development.json test --driver-package meteortesting:mocha --port 3010
TEST_WATCH=1 MONGO_URL=mongodb://localhost:27017/fuegostest meteor --settings settings-development.json test --driver-package meteortesting:mocha --port 3010
# and

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);