linting and fix defualt module test

This commit is contained in:
Felix Wiedenbach 2021-01-05 20:04:02 +01:00
parent f90856808b
commit a9a70fd2e9
2 changed files with 10 additions and 20 deletions

View File

@ -90,7 +90,7 @@ function App() {
const deprecated = require(`${global.root_path}/js/deprecated`);
const deprecatedOptions = deprecated.configs;
const usedDeprecated = deprecatedOptions.filter(option => userConfig.hasOwnProperty(option));
const usedDeprecated = deprecatedOptions.filter((option) => userConfig.hasOwnProperty(option));
if (usedDeprecated.length > 0) {
Log.warn(Utils.colors.warn(`WARNING! Your config is using deprecated options: ${usedDeprecated.join(", ")}. Check README and CHANGELOG for more up-to-date ways of getting the same functionality.`));
}
@ -236,7 +236,7 @@ function App() {
});
});
});
}
};
/**
* Stops the core app. This calls each node_helper's STOP() function, if it

View File

@ -3,12 +3,12 @@ const path = require("path");
const expect = require("chai").expect;
const vm = require("vm");
before(function () {
var basedir = path.join(__dirname, "../../..");
const basedir = path.join(__dirname, "../../..");
var fileName = "js/app.js";
var filePath = path.join(basedir, fileName);
var code = fs.readFileSync(filePath);
before(function () {
const fileName = "js/app.js";
const filePath = path.join(basedir, fileName);
const code = fs.readFileSync(filePath);
this.sandbox = {
module: {},
@ -36,22 +36,12 @@ before(function () {
vm.runInNewContext(code, this.sandbox, fileName);
});
after(function () {
//console.log(global);
});
describe("Default modules set in modules/default/defaultmodules.js", function () {
var expectedDefaultModules = ["alert", "calendar", "clock", "compliments", "currentweather", "helloworld", "newsfeed", "weatherforecast", "updatenotification"];
const expectedDefaultModules = require("../../../modules/default/defaultmodules");
expectedDefaultModules.forEach((defaultModule) => {
it(`contains default module "${defaultModule}"`, function () {
expect(this.sandbox.defaultModules).to.include(defaultModule);
});
});
expectedDefaultModules.forEach((defaultModule) => {
for (const defaultModule of expectedDefaultModules) {
it(`contains a folder for modules/default/${defaultModule}"`, function () {
expect(fs.existsSync(path.join(this.sandbox.global.root_path, "modules/default", defaultModule))).to.equal(true);
});
});
}
});