Change asserts to expects, add one more test

This commit is contained in:
Ilya Ig. Petrov 2017-05-05 21:38:26 -07:00
parent 74482c1257
commit 1feca9b31d
3 changed files with 11 additions and 5 deletions

View File

@ -104,9 +104,12 @@
const getCurrentConfigs = function getCurrentConfigs() { const getCurrentConfigs = function getCurrentConfigs() {
return kitchenState(modsKey); const oldMods = kitchenState(modsKey);
if (oldMods) {
return oldMods;
}
// In case of migration. // In case of migration or first install.
const [err, mods, ...warns] = createPacModifiers( kitchenState(modsKey) ); const [err, mods, ...warns] = createPacModifiers( kitchenState(modsKey) );
if (err) { if (err) {
throw err; throw err;

View File

@ -24,7 +24,10 @@ Mocha.describe('window.apis.pacKitchen', function () {
Mocha.it('is evaluated and defined', function () { Mocha.it('is evaluated and defined', function () {
CachelessRequire('../35-pac-kitchen-api.js'); CachelessRequire('../35-pac-kitchen-api.js');
Chai.assert.ok(window.apis.pacKitchen, 'exports to globals'); Chai.expect(window.apis.pacKitchen, 'to be exported as global').to.exist;
const mods = window.apis.pacKitchen.getPacMods();
Chai.expect(mods, 'expose default configs on first run').to.exist;
}); });

View File

@ -18,8 +18,8 @@ Mocha.describe('window.utils', function () {
Mocha.it('exports as global', function () { Mocha.it('exports as global', function () {
CachelessRequire(initApis); CachelessRequire(initApis);
Chai.assert.ok(window.utils, 'exported to globals'); Chai.expect(window.utils, 'to be exported as global').to.exist;
Chai.assert.isNotOk(window.apis.version.ifMini, 'is not MINI version'); Chai.expect(window.apis.version.ifMini, 'to be marked as not MINI version by default').to.be.false;
}); });