diff --git a/tests/configs/modules/calendar/custom.js b/tests/configs/modules/calendar/custom.js index 3d806ce9..6b0e6707 100644 --- a/tests/configs/modules/calendar/custom.js +++ b/tests/configs/modules/calendar/custom.js @@ -1,5 +1,6 @@ /* Magic Mirror Test config custom calendar * + * By Rejas * MIT Licensed. */ let config = { diff --git a/tests/configs/modules/clock/es/clock_showWeek.js b/tests/configs/modules/clock/es/clock_showWeek.js index 1e6843b1..d86db2d7 100644 --- a/tests/configs/modules/clock/es/clock_showWeek.js +++ b/tests/configs/modules/clock/es/clock_showWeek.js @@ -1,9 +1,7 @@ /* Magic Mirror Test config for default clock module * Language es for showWeek feature * - * By Rodrigo Ramírez Norambuena - * https://rodrigoramirez.com - * + * By Rodrigo Ramírez Norambuena https://rodrigoramirez.com * MIT Licensed. */ let config = { diff --git a/tests/configs/modules/display.js b/tests/configs/modules/display.js index 547bc12b..d22e3cf5 100644 --- a/tests/configs/modules/display.js +++ b/tests/configs/modules/display.js @@ -1,5 +1,6 @@ /* Magic Mirror Test config for display setters module using the helloworld module * + * By Rejas * MIT Licensed. */ let config = { @@ -37,6 +38,7 @@ let config = { } ] }; + /*************** DO NOT EDIT THE LINE BELOW ***************/ if (typeof module !== "undefined") { module.exports = config; diff --git a/tests/configs/modules/positions.js b/tests/configs/modules/positions.js index c6b2bf68..b99316ce 100644 --- a/tests/configs/modules/positions.js +++ b/tests/configs/modules/positions.js @@ -1,6 +1,4 @@ -/* Magic Mirror Test config for position setters module - * - * For this case is using helloworld module +/* Magic Mirror Test config for position setters module using the helloworld module * * By Rodrigo Ramírez Norambuena https://rodrigoramirez.com * MIT Licensed. @@ -36,6 +34,7 @@ let config = { return modules; })() }; + /*************** DO NOT EDIT THE LINE BELOW ***************/ if (typeof module !== "undefined") { module.exports = config; diff --git a/tests/configs/modules/weather/currentweather_compliments.js b/tests/configs/modules/weather/currentweather_compliments.js index b2aaeeed..0a039b36 100644 --- a/tests/configs/modules/weather/currentweather_compliments.js +++ b/tests/configs/modules/weather/currentweather_compliments.js @@ -1,10 +1,8 @@ /* Magic Mirror Test config current weather compliments * * By rejas https://github.com/rejas - * * MIT Licensed. */ - let config = { port: 8080, ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], diff --git a/tests/configs/modules/weather/currentweather_default.js b/tests/configs/modules/weather/currentweather_default.js index 9d53d3b0..440cc725 100644 --- a/tests/configs/modules/weather/currentweather_default.js +++ b/tests/configs/modules/weather/currentweather_default.js @@ -1,10 +1,8 @@ /* Magic Mirror Test config default weather * * By fewieden https://github.com/fewieden - * * MIT Licensed. */ - let config = { port: 8080, ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], diff --git a/tests/configs/modules/weather/currentweather_options.js b/tests/configs/modules/weather/currentweather_options.js index 722aa746..3fcd49b9 100644 --- a/tests/configs/modules/weather/currentweather_options.js +++ b/tests/configs/modules/weather/currentweather_options.js @@ -1,10 +1,8 @@ /* Magic Mirror Test config default weather * * By fewieden https://github.com/fewieden - * * MIT Licensed. */ - let config = { port: 8080, ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], diff --git a/tests/configs/modules/weather/currentweather_units.js b/tests/configs/modules/weather/currentweather_units.js index 35bf62b0..9eba6660 100644 --- a/tests/configs/modules/weather/currentweather_units.js +++ b/tests/configs/modules/weather/currentweather_units.js @@ -1,10 +1,8 @@ /* Magic Mirror Test config default weather * * By fewieden https://github.com/fewieden - * * MIT Licensed. */ - let config = { port: 8080, ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], diff --git a/tests/configs/modules/weather/forecastweather_default.js b/tests/configs/modules/weather/forecastweather_default.js index 60a83f17..dbe2d7e3 100644 --- a/tests/configs/modules/weather/forecastweather_default.js +++ b/tests/configs/modules/weather/forecastweather_default.js @@ -1,10 +1,8 @@ /* Magic Mirror Test config default weather * * By fewieden https://github.com/fewieden - * * MIT Licensed. */ - let config = { port: 8080, ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], diff --git a/tests/configs/modules/weather/forecastweather_options.js b/tests/configs/modules/weather/forecastweather_options.js index ccb2de98..32e0c8af 100644 --- a/tests/configs/modules/weather/forecastweather_options.js +++ b/tests/configs/modules/weather/forecastweather_options.js @@ -1,10 +1,8 @@ /* Magic Mirror Test config default weather * * By fewieden https://github.com/fewieden - * * MIT Licensed. */ - let config = { port: 8080, ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], diff --git a/tests/e2e/dev_console.js b/tests/e2e/dev_console.js index 4e5d1ca1..e6400bef 100644 --- a/tests/e2e/dev_console.js +++ b/tests/e2e/dev_console.js @@ -12,7 +12,7 @@ describe("Development console tests", function () { /* eslint-disable */ helpers.setupTimeout(this); - var app = null; + let app = null; before(function () { // Set config sample for use in test diff --git a/tests/e2e/env_spec.js b/tests/e2e/env_spec.js index 9c827055..1ec4a086 100644 --- a/tests/e2e/env_spec.js +++ b/tests/e2e/env_spec.js @@ -10,7 +10,7 @@ const afterEach = global.afterEach; describe("Electron app environment", function () { helpers.setupTimeout(this); - var app = null; + let app = null; before(function () { // Set config sample for use in test diff --git a/tests/e2e/global-setup.js b/tests/e2e/global-setup.js index ed6217d3..801c61e5 100644 --- a/tests/e2e/global-setup.js +++ b/tests/e2e/global-setup.js @@ -1,13 +1,9 @@ /* - * Magic Mirror - * - * Global Setup Test Suite + * Magic Mirror Global Setup Test Suite * * By Rodrigo Ramírez Norambuena https://rodrigoramirez.com * MIT Licensed. - * */ - const Application = require("spectron").Application; const assert = require("assert"); const chai = require("chai"); diff --git a/tests/e2e/ipWhistlist_spec.js b/tests/e2e/ipWhistlist_spec.js index 203bc711..1c259f1e 100644 --- a/tests/e2e/ipWhistlist_spec.js +++ b/tests/e2e/ipWhistlist_spec.js @@ -10,7 +10,7 @@ const afterEach = global.afterEach; describe("ipWhitelist directive configuration", function () { helpers.setupTimeout(this); - var app = null; + let app = null; beforeEach(function () { return helpers @@ -31,6 +31,7 @@ describe("ipWhitelist directive configuration", function () { // Set config sample for use in test process.env.MM_CONFIG_FILE = "tests/configs/noIpWhiteList.js"; }); + it("should return 403", function (done) { fetch("http://localhost:8080").then((res) => { expect(res.status).to.equal(403); @@ -44,6 +45,7 @@ describe("ipWhitelist directive configuration", function () { // Set config sample for use in test process.env.MM_CONFIG_FILE = "tests/configs/empty_ipWhiteList.js"; }); + it("should return 200", function (done) { fetch("http://localhost:8080").then((res) => { expect(res.status).to.equal(200); diff --git a/tests/e2e/modules_display_spec.js b/tests/e2e/modules_display_spec.js index 3dfcf26f..5ae06b6f 100644 --- a/tests/e2e/modules_display_spec.js +++ b/tests/e2e/modules_display_spec.js @@ -6,7 +6,7 @@ const it = global.it; describe("Display of modules", function () { helpers.setupTimeout(this); - var app = null; + let app = null; beforeEach(function () { return helpers diff --git a/tests/e2e/modules_position_spec.js b/tests/e2e/modules_position_spec.js index 8b86d8ad..7e8662be 100644 --- a/tests/e2e/modules_position_spec.js +++ b/tests/e2e/modules_position_spec.js @@ -6,7 +6,7 @@ const it = global.it; describe("Position of modules", function () { helpers.setupTimeout(this); - var app = null; + let app = null; describe("Using helloworld", function () { after(function () { @@ -25,14 +25,11 @@ describe("Position of modules", function () { }); }); - var positions = ["top_bar", "top_left", "top_center", "top_right", "upper_third", "middle_center", "lower_third", "bottom_left", "bottom_center", "bottom_right", "bottom_bar", "fullscreen_above", "fullscreen_below"]; + const positions = ["top_bar", "top_left", "top_center", "top_right", "upper_third", "middle_center", "lower_third", "bottom_left", "bottom_center", "bottom_right", "bottom_bar", "fullscreen_above", "fullscreen_below"]; - var position; - var className; - for (var idx in positions) { - position = positions[idx]; - className = position.replace("_", "."); - it("show text in " + position, function () { + for (const position of positions) { + const className = position.replace("_", "."); + it("should show text in " + position, function () { return app.client.$("." + className).then((result) => { return result.getText("." + className).should.eventually.equal("Text in " + position); }); diff --git a/tests/e2e/port_config.js b/tests/e2e/port_config.js index 9f45f486..e32f577b 100644 --- a/tests/e2e/port_config.js +++ b/tests/e2e/port_config.js @@ -10,7 +10,7 @@ const afterEach = global.afterEach; describe("port directive configuration", function () { helpers.setupTimeout(this); - var app = null; + let app = null; beforeEach(function () { return helpers diff --git a/tests/e2e/vendor_spec.js b/tests/e2e/vendor_spec.js index d31a2493..49499756 100644 --- a/tests/e2e/vendor_spec.js +++ b/tests/e2e/vendor_spec.js @@ -10,7 +10,7 @@ const after = global.after; describe("Vendors", function () { helpers.setupTimeout(this); - var app = null; + let app = null; before(function () { process.env.MM_CONFIG_FILE = "tests/configs/env.js"; @@ -31,7 +31,7 @@ describe("Vendors", function () { const vendors = require(__dirname + "/../../vendor/vendor.js"); Object.keys(vendors).forEach((vendor) => { it(`should return 200 HTTP code for vendor "${vendor}"`, function () { - var urlVendor = "http://localhost:8080/vendor/" + vendors[vendor]; + const urlVendor = "http://localhost:8080/vendor/" + vendors[vendor]; fetch(urlVendor).then((res) => { expect(res.status).to.equal(200); }); @@ -40,7 +40,7 @@ describe("Vendors", function () { Object.keys(vendors).forEach((vendor) => { it(`should return 404 HTTP code for vendor https://localhost/"${vendor}"`, function () { - var urlVendor = "http://localhost:8080/" + vendors[vendor]; + const urlVendor = "http://localhost:8080/" + vendors[vendor]; fetch(urlVendor).then((res) => { expect(res.status).to.equal(404); }); diff --git a/tests/e2e/without_modules.js b/tests/e2e/without_modules.js index 050c8a84..637236ba 100644 --- a/tests/e2e/without_modules.js +++ b/tests/e2e/without_modules.js @@ -8,7 +8,7 @@ const afterEach = global.afterEach; describe("Check configuration without modules", function () { helpers.setupTimeout(this); - var app = null; + let app = null; beforeEach(function () { return helpers diff --git a/tests/unit/classes/utils_spec.js b/tests/unit/classes/utils_spec.js index 82c9a2ff..d41411d9 100644 --- a/tests/unit/classes/utils_spec.js +++ b/tests/unit/classes/utils_spec.js @@ -4,7 +4,7 @@ const colors = require("colors/safe"); describe("Utils", function () { describe("colors", function () { - var colorsEnabled = colors.enabled; + const colorsEnabled = colors.enabled; afterEach(function () { colors.enabled = colorsEnabled; diff --git a/tests/unit/functions/currentweather_spec.js b/tests/unit/functions/currentweather_spec.js index 2a29002e..d5a96e3e 100644 --- a/tests/unit/functions/currentweather_spec.js +++ b/tests/unit/functions/currentweather_spec.js @@ -21,7 +21,7 @@ describe("Functions module currentweather", function () { Module.definitions.currentweather.config.roundTemp = true; }); - var values = [ + const values = [ // index 0 value // index 1 expect [1, "1"], @@ -45,7 +45,7 @@ describe("Functions module currentweather", function () { Module.definitions.currentweather.config.roundTemp = false; }); - var values = [ + const values = [ // index 0 value // index 1 expect [1, "1.0"], diff --git a/tests/unit/functions/weatherforecast_spec.js b/tests/unit/functions/weatherforecast_spec.js index 96ddc77f..42bd20d4 100644 --- a/tests/unit/functions/weatherforecast_spec.js +++ b/tests/unit/functions/weatherforecast_spec.js @@ -1,7 +1,7 @@ /* eslint no-multi-spaces: 0 */ const expect = require("chai").expect; const moment = require("moment-timezone"); -var data = require("../functions/weatherforecast_data.json"); +const data = require("../functions/weatherforecast_data.json"); describe("Functions module weatherforecast", function () { before(function () { @@ -21,7 +21,7 @@ describe("Functions module weatherforecast", function () { Module.definitions.weatherforecast.config.roundTemp = true; }); - var values = [ + const values = [ // index 0 value // index 1 expect [1, "1"], @@ -45,7 +45,7 @@ describe("Functions module weatherforecast", function () { Module.definitions.weatherforecast.config.roundTemp = false; }); - var values = [ + const values = [ // index 0 value // index 1 expect [1, "1.0"], @@ -71,8 +71,8 @@ describe("Functions module weatherforecast", function () { error: function () {} }; - var originalLocale; - var originalTimeZone; + let originalLocale; + let originalTimeZone; before(function () { originalLocale = moment.locale(); originalTimeZone = moment.tz.guess(); diff --git a/tests/unit/global_vars/root_path_spec.js b/tests/unit/global_vars/root_path_spec.js index c48bfc55..dc44b270 100644 --- a/tests/unit/global_vars/root_path_spec.js +++ b/tests/unit/global_vars/root_path_spec.js @@ -4,11 +4,11 @@ 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); + const fileName = "js/app.js"; + const filePath = path.join(basedir, fileName); + const code = fs.readFileSync(filePath); this.sandbox = { module: {}, @@ -41,7 +41,7 @@ after(function () { }); describe("'global.root_path' set in js/app.js", function () { - var expectedSubPaths = ["modules", "serveronly", "js", "js/app.js", "js/main.js", "js/electron.js", "config"]; + const expectedSubPaths = ["modules", "serveronly", "js", "js/app.js", "js/main.js", "js/electron.js", "config"]; expectedSubPaths.forEach((subpath) => { it(`contains a file/folder "${subpath}"`, function () {