mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 11:50:00 +00:00
Use es6 notation in tests
This commit is contained in:
parent
6eba8d681c
commit
d736dd92be
@ -1,5 +1,6 @@
|
|||||||
/* Magic Mirror Test config custom calendar
|
/* Magic Mirror Test config custom calendar
|
||||||
*
|
*
|
||||||
|
* By Rejas
|
||||||
* MIT Licensed.
|
* MIT Licensed.
|
||||||
*/
|
*/
|
||||||
let config = {
|
let config = {
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/* Magic Mirror Test config for default clock module
|
/* Magic Mirror Test config for default clock module
|
||||||
* Language es for showWeek feature
|
* Language es for showWeek feature
|
||||||
*
|
*
|
||||||
* By Rodrigo Ramírez Norambuena
|
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
|
||||||
* https://rodrigoramirez.com
|
|
||||||
*
|
|
||||||
* MIT Licensed.
|
* MIT Licensed.
|
||||||
*/
|
*/
|
||||||
let config = {
|
let config = {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
/* Magic Mirror Test config for display setters module using the helloworld module
|
/* Magic Mirror Test config for display setters module using the helloworld module
|
||||||
*
|
*
|
||||||
|
* By Rejas
|
||||||
* MIT Licensed.
|
* MIT Licensed.
|
||||||
*/
|
*/
|
||||||
let config = {
|
let config = {
|
||||||
@ -37,6 +38,7 @@ let config = {
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||||
if (typeof module !== "undefined") {
|
if (typeof module !== "undefined") {
|
||||||
module.exports = config;
|
module.exports = config;
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
/* Magic Mirror Test config for position setters module
|
/* Magic Mirror Test config for position setters module using the helloworld module
|
||||||
*
|
|
||||||
* For this case is using helloworld module
|
|
||||||
*
|
*
|
||||||
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
|
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
|
||||||
* MIT Licensed.
|
* MIT Licensed.
|
||||||
@ -36,6 +34,7 @@ let config = {
|
|||||||
return modules;
|
return modules;
|
||||||
})()
|
})()
|
||||||
};
|
};
|
||||||
|
|
||||||
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||||
if (typeof module !== "undefined") {
|
if (typeof module !== "undefined") {
|
||||||
module.exports = config;
|
module.exports = config;
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
/* Magic Mirror Test config current weather compliments
|
/* Magic Mirror Test config current weather compliments
|
||||||
*
|
*
|
||||||
* By rejas https://github.com/rejas
|
* By rejas https://github.com/rejas
|
||||||
*
|
|
||||||
* MIT Licensed.
|
* MIT Licensed.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
let config = {
|
let config = {
|
||||||
port: 8080,
|
port: 8080,
|
||||||
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],
|
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
/* Magic Mirror Test config default weather
|
/* Magic Mirror Test config default weather
|
||||||
*
|
*
|
||||||
* By fewieden https://github.com/fewieden
|
* By fewieden https://github.com/fewieden
|
||||||
*
|
|
||||||
* MIT Licensed.
|
* MIT Licensed.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
let config = {
|
let config = {
|
||||||
port: 8080,
|
port: 8080,
|
||||||
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],
|
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
/* Magic Mirror Test config default weather
|
/* Magic Mirror Test config default weather
|
||||||
*
|
*
|
||||||
* By fewieden https://github.com/fewieden
|
* By fewieden https://github.com/fewieden
|
||||||
*
|
|
||||||
* MIT Licensed.
|
* MIT Licensed.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
let config = {
|
let config = {
|
||||||
port: 8080,
|
port: 8080,
|
||||||
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],
|
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
/* Magic Mirror Test config default weather
|
/* Magic Mirror Test config default weather
|
||||||
*
|
*
|
||||||
* By fewieden https://github.com/fewieden
|
* By fewieden https://github.com/fewieden
|
||||||
*
|
|
||||||
* MIT Licensed.
|
* MIT Licensed.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
let config = {
|
let config = {
|
||||||
port: 8080,
|
port: 8080,
|
||||||
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],
|
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
/* Magic Mirror Test config default weather
|
/* Magic Mirror Test config default weather
|
||||||
*
|
*
|
||||||
* By fewieden https://github.com/fewieden
|
* By fewieden https://github.com/fewieden
|
||||||
*
|
|
||||||
* MIT Licensed.
|
* MIT Licensed.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
let config = {
|
let config = {
|
||||||
port: 8080,
|
port: 8080,
|
||||||
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],
|
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
/* Magic Mirror Test config default weather
|
/* Magic Mirror Test config default weather
|
||||||
*
|
*
|
||||||
* By fewieden https://github.com/fewieden
|
* By fewieden https://github.com/fewieden
|
||||||
*
|
|
||||||
* MIT Licensed.
|
* MIT Licensed.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
let config = {
|
let config = {
|
||||||
port: 8080,
|
port: 8080,
|
||||||
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],
|
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],
|
||||||
|
@ -12,7 +12,7 @@ describe("Development console tests", function () {
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
helpers.setupTimeout(this);
|
helpers.setupTimeout(this);
|
||||||
|
|
||||||
var app = null;
|
let app = null;
|
||||||
|
|
||||||
before(function () {
|
before(function () {
|
||||||
// Set config sample for use in test
|
// Set config sample for use in test
|
||||||
|
@ -10,7 +10,7 @@ const afterEach = global.afterEach;
|
|||||||
describe("Electron app environment", function () {
|
describe("Electron app environment", function () {
|
||||||
helpers.setupTimeout(this);
|
helpers.setupTimeout(this);
|
||||||
|
|
||||||
var app = null;
|
let app = null;
|
||||||
|
|
||||||
before(function () {
|
before(function () {
|
||||||
// Set config sample for use in test
|
// Set config sample for use in test
|
||||||
|
@ -1,13 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* Magic Mirror
|
* Magic Mirror Global Setup Test Suite
|
||||||
*
|
|
||||||
* Global Setup Test Suite
|
|
||||||
*
|
*
|
||||||
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
|
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
|
||||||
* MIT Licensed.
|
* MIT Licensed.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const Application = require("spectron").Application;
|
const Application = require("spectron").Application;
|
||||||
const assert = require("assert");
|
const assert = require("assert");
|
||||||
const chai = require("chai");
|
const chai = require("chai");
|
||||||
|
@ -10,7 +10,7 @@ const afterEach = global.afterEach;
|
|||||||
describe("ipWhitelist directive configuration", function () {
|
describe("ipWhitelist directive configuration", function () {
|
||||||
helpers.setupTimeout(this);
|
helpers.setupTimeout(this);
|
||||||
|
|
||||||
var app = null;
|
let app = null;
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
return helpers
|
return helpers
|
||||||
@ -31,6 +31,7 @@ describe("ipWhitelist directive configuration", function () {
|
|||||||
// Set config sample for use in test
|
// Set config sample for use in test
|
||||||
process.env.MM_CONFIG_FILE = "tests/configs/noIpWhiteList.js";
|
process.env.MM_CONFIG_FILE = "tests/configs/noIpWhiteList.js";
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should return 403", function (done) {
|
it("should return 403", function (done) {
|
||||||
fetch("http://localhost:8080").then((res) => {
|
fetch("http://localhost:8080").then((res) => {
|
||||||
expect(res.status).to.equal(403);
|
expect(res.status).to.equal(403);
|
||||||
@ -44,6 +45,7 @@ describe("ipWhitelist directive configuration", function () {
|
|||||||
// Set config sample for use in test
|
// Set config sample for use in test
|
||||||
process.env.MM_CONFIG_FILE = "tests/configs/empty_ipWhiteList.js";
|
process.env.MM_CONFIG_FILE = "tests/configs/empty_ipWhiteList.js";
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should return 200", function (done) {
|
it("should return 200", function (done) {
|
||||||
fetch("http://localhost:8080").then((res) => {
|
fetch("http://localhost:8080").then((res) => {
|
||||||
expect(res.status).to.equal(200);
|
expect(res.status).to.equal(200);
|
||||||
|
@ -6,7 +6,7 @@ const it = global.it;
|
|||||||
describe("Display of modules", function () {
|
describe("Display of modules", function () {
|
||||||
helpers.setupTimeout(this);
|
helpers.setupTimeout(this);
|
||||||
|
|
||||||
var app = null;
|
let app = null;
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
return helpers
|
return helpers
|
||||||
|
@ -6,7 +6,7 @@ const it = global.it;
|
|||||||
describe("Position of modules", function () {
|
describe("Position of modules", function () {
|
||||||
helpers.setupTimeout(this);
|
helpers.setupTimeout(this);
|
||||||
|
|
||||||
var app = null;
|
let app = null;
|
||||||
|
|
||||||
describe("Using helloworld", function () {
|
describe("Using helloworld", function () {
|
||||||
after(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;
|
for (const position of positions) {
|
||||||
var className;
|
const className = position.replace("_", ".");
|
||||||
for (var idx in positions) {
|
it("should show text in " + position, function () {
|
||||||
position = positions[idx];
|
|
||||||
className = position.replace("_", ".");
|
|
||||||
it("show text in " + position, function () {
|
|
||||||
return app.client.$("." + className).then((result) => {
|
return app.client.$("." + className).then((result) => {
|
||||||
return result.getText("." + className).should.eventually.equal("Text in " + position);
|
return result.getText("." + className).should.eventually.equal("Text in " + position);
|
||||||
});
|
});
|
||||||
|
@ -10,7 +10,7 @@ const afterEach = global.afterEach;
|
|||||||
describe("port directive configuration", function () {
|
describe("port directive configuration", function () {
|
||||||
helpers.setupTimeout(this);
|
helpers.setupTimeout(this);
|
||||||
|
|
||||||
var app = null;
|
let app = null;
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
return helpers
|
return helpers
|
||||||
|
@ -10,7 +10,7 @@ const after = global.after;
|
|||||||
describe("Vendors", function () {
|
describe("Vendors", function () {
|
||||||
helpers.setupTimeout(this);
|
helpers.setupTimeout(this);
|
||||||
|
|
||||||
var app = null;
|
let app = null;
|
||||||
|
|
||||||
before(function () {
|
before(function () {
|
||||||
process.env.MM_CONFIG_FILE = "tests/configs/env.js";
|
process.env.MM_CONFIG_FILE = "tests/configs/env.js";
|
||||||
@ -31,7 +31,7 @@ describe("Vendors", function () {
|
|||||||
const vendors = require(__dirname + "/../../vendor/vendor.js");
|
const vendors = require(__dirname + "/../../vendor/vendor.js");
|
||||||
Object.keys(vendors).forEach((vendor) => {
|
Object.keys(vendors).forEach((vendor) => {
|
||||||
it(`should return 200 HTTP code for vendor "${vendor}"`, function () {
|
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) => {
|
fetch(urlVendor).then((res) => {
|
||||||
expect(res.status).to.equal(200);
|
expect(res.status).to.equal(200);
|
||||||
});
|
});
|
||||||
@ -40,7 +40,7 @@ describe("Vendors", function () {
|
|||||||
|
|
||||||
Object.keys(vendors).forEach((vendor) => {
|
Object.keys(vendors).forEach((vendor) => {
|
||||||
it(`should return 404 HTTP code for vendor https://localhost/"${vendor}"`, function () {
|
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) => {
|
fetch(urlVendor).then((res) => {
|
||||||
expect(res.status).to.equal(404);
|
expect(res.status).to.equal(404);
|
||||||
});
|
});
|
||||||
|
@ -8,7 +8,7 @@ const afterEach = global.afterEach;
|
|||||||
describe("Check configuration without modules", function () {
|
describe("Check configuration without modules", function () {
|
||||||
helpers.setupTimeout(this);
|
helpers.setupTimeout(this);
|
||||||
|
|
||||||
var app = null;
|
let app = null;
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
return helpers
|
return helpers
|
||||||
|
@ -4,7 +4,7 @@ const colors = require("colors/safe");
|
|||||||
|
|
||||||
describe("Utils", function () {
|
describe("Utils", function () {
|
||||||
describe("colors", function () {
|
describe("colors", function () {
|
||||||
var colorsEnabled = colors.enabled;
|
const colorsEnabled = colors.enabled;
|
||||||
|
|
||||||
afterEach(function () {
|
afterEach(function () {
|
||||||
colors.enabled = colorsEnabled;
|
colors.enabled = colorsEnabled;
|
||||||
|
@ -21,7 +21,7 @@ describe("Functions module currentweather", function () {
|
|||||||
Module.definitions.currentweather.config.roundTemp = true;
|
Module.definitions.currentweather.config.roundTemp = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
var values = [
|
const values = [
|
||||||
// index 0 value
|
// index 0 value
|
||||||
// index 1 expect
|
// index 1 expect
|
||||||
[1, "1"],
|
[1, "1"],
|
||||||
@ -45,7 +45,7 @@ describe("Functions module currentweather", function () {
|
|||||||
Module.definitions.currentweather.config.roundTemp = false;
|
Module.definitions.currentweather.config.roundTemp = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
var values = [
|
const values = [
|
||||||
// index 0 value
|
// index 0 value
|
||||||
// index 1 expect
|
// index 1 expect
|
||||||
[1, "1.0"],
|
[1, "1.0"],
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/* eslint no-multi-spaces: 0 */
|
/* eslint no-multi-spaces: 0 */
|
||||||
const expect = require("chai").expect;
|
const expect = require("chai").expect;
|
||||||
const moment = require("moment-timezone");
|
const moment = require("moment-timezone");
|
||||||
var data = require("../functions/weatherforecast_data.json");
|
const data = require("../functions/weatherforecast_data.json");
|
||||||
|
|
||||||
describe("Functions module weatherforecast", function () {
|
describe("Functions module weatherforecast", function () {
|
||||||
before(function () {
|
before(function () {
|
||||||
@ -21,7 +21,7 @@ describe("Functions module weatherforecast", function () {
|
|||||||
Module.definitions.weatherforecast.config.roundTemp = true;
|
Module.definitions.weatherforecast.config.roundTemp = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
var values = [
|
const values = [
|
||||||
// index 0 value
|
// index 0 value
|
||||||
// index 1 expect
|
// index 1 expect
|
||||||
[1, "1"],
|
[1, "1"],
|
||||||
@ -45,7 +45,7 @@ describe("Functions module weatherforecast", function () {
|
|||||||
Module.definitions.weatherforecast.config.roundTemp = false;
|
Module.definitions.weatherforecast.config.roundTemp = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
var values = [
|
const values = [
|
||||||
// index 0 value
|
// index 0 value
|
||||||
// index 1 expect
|
// index 1 expect
|
||||||
[1, "1.0"],
|
[1, "1.0"],
|
||||||
@ -71,8 +71,8 @@ describe("Functions module weatherforecast", function () {
|
|||||||
error: function () {}
|
error: function () {}
|
||||||
};
|
};
|
||||||
|
|
||||||
var originalLocale;
|
let originalLocale;
|
||||||
var originalTimeZone;
|
let originalTimeZone;
|
||||||
before(function () {
|
before(function () {
|
||||||
originalLocale = moment.locale();
|
originalLocale = moment.locale();
|
||||||
originalTimeZone = moment.tz.guess();
|
originalTimeZone = moment.tz.guess();
|
||||||
|
@ -4,11 +4,11 @@ const expect = require("chai").expect;
|
|||||||
const vm = require("vm");
|
const vm = require("vm");
|
||||||
|
|
||||||
before(function () {
|
before(function () {
|
||||||
var basedir = path.join(__dirname, "../../..");
|
const basedir = path.join(__dirname, "../../..");
|
||||||
|
|
||||||
var fileName = "js/app.js";
|
const fileName = "js/app.js";
|
||||||
var filePath = path.join(basedir, fileName);
|
const filePath = path.join(basedir, fileName);
|
||||||
var code = fs.readFileSync(filePath);
|
const code = fs.readFileSync(filePath);
|
||||||
|
|
||||||
this.sandbox = {
|
this.sandbox = {
|
||||||
module: {},
|
module: {},
|
||||||
@ -41,7 +41,7 @@ after(function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe("'global.root_path' set in js/app.js", 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) => {
|
expectedSubPaths.forEach((subpath) => {
|
||||||
it(`contains a file/folder "${subpath}"`, function () {
|
it(`contains a file/folder "${subpath}"`, function () {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user