mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-30 04:59:32 +00:00
run prettier
This commit is contained in:
parent
044935a164
commit
1a244726aa
@ -22,7 +22,6 @@
|
|||||||
root.Log = factory(root.config);
|
root.Log = factory(root.config);
|
||||||
}
|
}
|
||||||
})(this, function (config) {
|
})(this, function (config) {
|
||||||
|
|
||||||
let logLevel = {
|
let logLevel = {
|
||||||
debug: Function.prototype.bind.call(console.debug, console),
|
debug: Function.prototype.bind.call(console.debug, console),
|
||||||
log: Function.prototype.bind.call(console.log, console),
|
log: Function.prototype.bind.call(console.log, console),
|
||||||
@ -37,8 +36,8 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (process.env.NODE_ENV.trim() !== "test") {
|
if (process.env.NODE_ENV.trim() !== "test") {
|
||||||
logLevel.push({timeStamp: Function.prototype.bind.call(console.timeStamp, console)});
|
logLevel.push({ timeStamp: Function.prototype.bind.call(console.timeStamp, console) });
|
||||||
};
|
}
|
||||||
|
|
||||||
logLevel.setLogLevel = function (newLevel) {
|
logLevel.setLogLevel = function (newLevel) {
|
||||||
if (newLevel) {
|
if (newLevel) {
|
||||||
|
@ -341,7 +341,11 @@ Module.register("weatherforecast", {
|
|||||||
*/
|
*/
|
||||||
processWeather: function (data, momenttz) {
|
processWeather: function (data, momenttz) {
|
||||||
let mom;
|
let mom;
|
||||||
if (momenttz === null) {mom = moment} else {mom = momenttz};
|
if (momenttz === null) {
|
||||||
|
mom = moment;
|
||||||
|
} else {
|
||||||
|
mom = momenttz;
|
||||||
|
}
|
||||||
// Forcast16 (paid) API endpoint provides this data. Onecall endpoint
|
// Forcast16 (paid) API endpoint provides this data. Onecall endpoint
|
||||||
// does not.
|
// does not.
|
||||||
if (data.city) {
|
if (data.city) {
|
||||||
@ -486,7 +490,11 @@ Module.register("weatherforecast", {
|
|||||||
*/
|
*/
|
||||||
processRain: function (forecast, allForecasts, momenttz) {
|
processRain: function (forecast, allForecasts, momenttz) {
|
||||||
let mom;
|
let mom;
|
||||||
if (momenttz === null) {mom = moment} else {mom = momenttz};
|
if (momenttz === null) {
|
||||||
|
mom = moment;
|
||||||
|
} else {
|
||||||
|
mom = momenttz;
|
||||||
|
}
|
||||||
//If the amount of rain actually is a number, return it
|
//If the amount of rain actually is a number, return it
|
||||||
if (!isNaN(forecast.rain)) {
|
if (!isNaN(forecast.rain)) {
|
||||||
return forecast.rain;
|
return forecast.rain;
|
||||||
|
13
package.json
13
package.json
@ -95,7 +95,9 @@
|
|||||||
"projects": [
|
"projects": [
|
||||||
{
|
{
|
||||||
"displayName": "unit",
|
"displayName": "unit",
|
||||||
"testMatch": ["**/tests/unit/**/*.[jt]s?(x)"],
|
"testMatch": [
|
||||||
|
"**/tests/unit/**/*.[jt]s?(x)"
|
||||||
|
],
|
||||||
"moduleNameMapper": {
|
"moduleNameMapper": {
|
||||||
"node_helper": "<rootDir>/js/node_helper.js",
|
"node_helper": "<rootDir>/js/node_helper.js",
|
||||||
"logger": "<rootDir>/js/logger.js",
|
"logger": "<rootDir>/js/logger.js",
|
||||||
@ -105,8 +107,13 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"displayName": "e2e",
|
"displayName": "e2e",
|
||||||
"testMatch": ["**/tests/e2e/**/*.[jt]s?(x)"],
|
"testMatch": [
|
||||||
"testPathIgnorePatterns": ["<rootDir>/tests/e2e/modules/mocks", "<rootDir>/tests/e2e/global-setup.js"]
|
"**/tests/e2e/**/*.[jt]s?(x)"
|
||||||
|
],
|
||||||
|
"testPathIgnorePatterns": [
|
||||||
|
"<rootDir>/tests/e2e/modules/mocks",
|
||||||
|
"<rootDir>/tests/e2e/global-setup.js"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,6 @@
|
|||||||
const helpers = require("./global-setup");
|
const helpers = require("./global-setup");
|
||||||
const fetch = require("node-fetch");
|
const fetch = require("node-fetch");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
describe("Electron app environment", function () {
|
describe("Electron app environment", function () {
|
||||||
helpers.setupTimeout(this);
|
helpers.setupTimeout(this);
|
||||||
|
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
const helpers = require("./global-setup");
|
const helpers = require("./global-setup");
|
||||||
const fetch = require("node-fetch");
|
const fetch = require("node-fetch");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
describe("All font files from roboto.css should be downloadable", function () {
|
describe("All font files from roboto.css should be downloadable", function () {
|
||||||
helpers.setupTimeout(this);
|
helpers.setupTimeout(this);
|
||||||
|
|
||||||
|
@ -1,10 +1,5 @@
|
|||||||
const helpers = require("../global-setup");
|
const helpers = require("../global-setup");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
describe("Alert module", function () {
|
describe("Alert module", function () {
|
||||||
helpers.setupTimeout(this);
|
helpers.setupTimeout(this);
|
||||||
|
|
||||||
|
@ -1,11 +1,6 @@
|
|||||||
const helpers = require("../global-setup");
|
const helpers = require("../global-setup");
|
||||||
const serverBasicAuth = require("../../servers/basic-auth.js");
|
const serverBasicAuth = require("../../servers/basic-auth.js");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
describe("Calendar module", function () {
|
describe("Calendar module", function () {
|
||||||
helpers.setupTimeout(this);
|
helpers.setupTimeout(this);
|
||||||
|
|
||||||
|
@ -1,10 +1,5 @@
|
|||||||
const helpers = require("../global-setup");
|
const helpers = require("../global-setup");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
describe("Clock set to spanish language module", function () {
|
describe("Clock set to spanish language module", function () {
|
||||||
helpers.setupTimeout(this);
|
helpers.setupTimeout(this);
|
||||||
|
|
||||||
|
@ -1,11 +1,6 @@
|
|||||||
const helpers = require("../global-setup");
|
const helpers = require("../global-setup");
|
||||||
const moment = require("moment");
|
const moment = require("moment");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
describe("Clock module", function () {
|
describe("Clock module", function () {
|
||||||
helpers.setupTimeout(this);
|
helpers.setupTimeout(this);
|
||||||
|
|
||||||
@ -105,7 +100,7 @@ describe("Clock module", function () {
|
|||||||
const currentWeekNumber = moment().week();
|
const currentWeekNumber = moment().week();
|
||||||
const weekToShow = "Week " + currentWeekNumber;
|
const weekToShow = "Week " + currentWeekNumber;
|
||||||
const elem = await app.client.$(".clock .week");
|
const elem = await app.client.$(".clock .week");
|
||||||
return (elem.getText(".clock .week") === weekToShow);
|
return elem.getText(".clock .week") === weekToShow;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,10 +1,5 @@
|
|||||||
const helpers = require("../global-setup");
|
const helpers = require("../global-setup");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
describe("Compliments module", function () {
|
describe("Compliments module", function () {
|
||||||
helpers.setupTimeout(this);
|
helpers.setupTimeout(this);
|
||||||
|
|
||||||
@ -36,7 +31,7 @@ describe("Compliments module", function () {
|
|||||||
// if morning check
|
// if morning check
|
||||||
const elem = await app.client.$(".compliments");
|
const elem = await app.client.$(".compliments");
|
||||||
return elem.getText(".compliments").then(function (text) {
|
return elem.getText(".compliments").then(function (text) {
|
||||||
expect(["Hi", "Good Morning", "Morning test"]).toContain(text)
|
expect(["Hi", "Good Morning", "Morning test"]).toContain(text);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -47,7 +42,7 @@ describe("Compliments module", function () {
|
|||||||
// if afternoon check
|
// if afternoon check
|
||||||
const elem = await app.client.$(".compliments");
|
const elem = await app.client.$(".compliments");
|
||||||
return elem.getText(".compliments").then(function (text) {
|
return elem.getText(".compliments").then(function (text) {
|
||||||
expect(["Hello", "Good Afternoon", "Afternoon test"]).toContain(text)
|
expect(["Hello", "Good Afternoon", "Afternoon test"]).toContain(text);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -58,7 +53,7 @@ describe("Compliments module", function () {
|
|||||||
// if evening check
|
// if evening check
|
||||||
const elem = await app.client.$(".compliments");
|
const elem = await app.client.$(".compliments");
|
||||||
return elem.getText(".compliments").then(function (text) {
|
return elem.getText(".compliments").then(function (text) {
|
||||||
expect(["Hello There", "Good Evening", "Evening test"]).toContain(text)
|
expect(["Hello There", "Good Evening", "Evening test"]).toContain(text);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -74,7 +69,7 @@ describe("Compliments module", function () {
|
|||||||
it("Show anytime because if configure empty parts of day compliments and set anytime compliments", async function () {
|
it("Show anytime because if configure empty parts of day compliments and set anytime compliments", async function () {
|
||||||
const elem = await app.client.$(".compliments");
|
const elem = await app.client.$(".compliments");
|
||||||
return elem.getText(".compliments").then(function (text) {
|
return elem.getText(".compliments").then(function (text) {
|
||||||
expect(["Anytime here"]).toContain(text)
|
expect(["Anytime here"]).toContain(text);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -88,7 +83,7 @@ describe("Compliments module", function () {
|
|||||||
it("Show anytime compliments", async function () {
|
it("Show anytime compliments", async function () {
|
||||||
const elem = await app.client.$(".compliments");
|
const elem = await app.client.$(".compliments");
|
||||||
return elem.getText(".compliments").then(function (text) {
|
return elem.getText(".compliments").then(function (text) {
|
||||||
expect(["Anytime here"]).toContain(text)
|
expect(["Anytime here"]).toContain(text);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -104,7 +99,7 @@ describe("Compliments module", function () {
|
|||||||
it("Show happy new year compliment on new years day", async function () {
|
it("Show happy new year compliment on new years day", async function () {
|
||||||
const elem = await app.client.$(".compliments");
|
const elem = await app.client.$(".compliments");
|
||||||
return elem.getText(".compliments").then(function (text) {
|
return elem.getText(".compliments").then(function (text) {
|
||||||
expect(["Happy new year!"]).toContain(text)
|
expect(["Happy new year!"]).toContain(text);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -27,7 +27,7 @@ describe("Test helloworld module", function () {
|
|||||||
|
|
||||||
it("Test message helloworld module", async function () {
|
it("Test message helloworld module", async function () {
|
||||||
const elem = await app.client.$(".helloworld");
|
const elem = await app.client.$(".helloworld");
|
||||||
return (elem.getText(".helloworld") === "Test HelloWorld Module");
|
return elem.getText(".helloworld") === "Test HelloWorld Module";
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ describe("Test helloworld module", function () {
|
|||||||
|
|
||||||
it("Test message helloworld module", async function () {
|
it("Test message helloworld module", async function () {
|
||||||
const elem = await app.client.$(".helloworld");
|
const elem = await app.client.$(".helloworld");
|
||||||
return (elem.getText(".helloworld") === "Hello World!");
|
return elem.getText(".helloworld") === "Hello World!";
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -1,10 +1,5 @@
|
|||||||
const helpers = require("../global-setup");
|
const helpers = require("../global-setup");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
describe("Newsfeed module", function () {
|
describe("Newsfeed module", function () {
|
||||||
helpers.setupTimeout(this);
|
helpers.setupTimeout(this);
|
||||||
|
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
const helpers = require("./global-setup");
|
const helpers = require("./global-setup");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
describe("Display of modules", function () {
|
describe("Display of modules", function () {
|
||||||
helpers.setupTimeout(this);
|
helpers.setupTimeout(this);
|
||||||
|
|
||||||
@ -30,12 +27,12 @@ describe("Display of modules", function () {
|
|||||||
|
|
||||||
it("should show the test header", async () => {
|
it("should show the test header", async () => {
|
||||||
const elem = await app.client.$("#module_0_helloworld .module-header", 10000);
|
const elem = await app.client.$("#module_0_helloworld .module-header", 10000);
|
||||||
return (elem.getText("#module_0_helloworld .module-header") === "TEST_HEADER");
|
return elem.getText("#module_0_helloworld .module-header") === "TEST_HEADER";
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should show no header if no header text is specified", async () => {
|
it("should show no header if no header text is specified", async () => {
|
||||||
const elem = await app.client.$("#module_1_helloworld .module-header", 10000);
|
const elem = await app.client.$("#module_1_helloworld .module-header", 10000);
|
||||||
return (elem.getText("#module_1_helloworld .module-header") === false);
|
return elem.getText("#module_1_helloworld .module-header") === false;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
const helpers = require("./global-setup");
|
const helpers = require("./global-setup");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
describe("Position of modules", function () {
|
describe("Position of modules", function () {
|
||||||
helpers.setupTimeout(this);
|
helpers.setupTimeout(this);
|
||||||
|
|
||||||
@ -31,7 +28,7 @@ describe("Position of modules", function () {
|
|||||||
const className = position.replace("_", ".");
|
const className = position.replace("_", ".");
|
||||||
it("should show text in " + position, function () {
|
it("should show text in " + position, function () {
|
||||||
return app.client.$("." + className).then((result) => {
|
return app.client.$("." + className).then((result) => {
|
||||||
return (result.getText("." + className) === "Text in " + position);
|
return result.getText("." + className) === "Text in " + position;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,6 @@
|
|||||||
const helpers = require("./global-setup");
|
const helpers = require("./global-setup");
|
||||||
const fetch = require("node-fetch");
|
const fetch = require("node-fetch");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
describe("port directive configuration", function () {
|
describe("port directive configuration", function () {
|
||||||
helpers.setupTimeout(this);
|
helpers.setupTimeout(this);
|
||||||
|
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
const helpers = require("./global-setup");
|
const helpers = require("./global-setup");
|
||||||
const fetch = require("node-fetch");
|
const fetch = require("node-fetch");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const before = global.before;
|
const before = global.before;
|
||||||
const after = global.after;
|
const after = global.after;
|
||||||
|
|
||||||
|
@ -1,10 +1,5 @@
|
|||||||
const helpers = require("./global-setup");
|
const helpers = require("./global-setup");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
describe("Check configuration without modules", function () {
|
describe("Check configuration without modules", function () {
|
||||||
helpers.setupTimeout(this);
|
helpers.setupTimeout(this);
|
||||||
|
|
||||||
@ -31,11 +26,11 @@ describe("Check configuration without modules", function () {
|
|||||||
|
|
||||||
it("Show the message MagicMirror title", async function () {
|
it("Show the message MagicMirror title", async function () {
|
||||||
const elem = await app.client.$("#module_1_helloworld .module-content");
|
const elem = await app.client.$("#module_1_helloworld .module-content");
|
||||||
return (elem.getText("#module_1_helloworld .module-content") === "Magic Mirror2");
|
return elem.getText("#module_1_helloworld .module-content") === "Magic Mirror2";
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Show the text Michael's website", async function () {
|
it("Show the text Michael's website", async function () {
|
||||||
const elem = await app.client.$("#module_5_helloworld .module-content");
|
const elem = await app.client.$("#module_5_helloworld .module-content");
|
||||||
return (elem.getText("#module_5_helloworld .module-content") === "www.michaelteeuw.nl");
|
return elem.getText("#module_5_helloworld .module-content") === "www.michaelteeuw.nl";
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -18,16 +18,15 @@ describe("Translator", function () {
|
|||||||
|
|
||||||
server = app.listen(3000);
|
server = app.listen(3000);
|
||||||
|
|
||||||
server.on('connection', (socket) => {
|
server.on("connection", (socket) => {
|
||||||
sockets.add(socket);
|
sockets.add(socket);
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(function () {
|
afterAll(function () {
|
||||||
for (const socket of sockets) {
|
for (const socket of sockets) {
|
||||||
socket.destroy();
|
socket.destroy();
|
||||||
|
|
||||||
sockets.delete(socket);
|
sockets.delete(socket);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,5 +11,5 @@ describe("Functions into modules/default/newsfeed/newsfeed.js", function () {
|
|||||||
require("../../../modules/default/newsfeed/newsfeed.js");
|
require("../../../modules/default/newsfeed/newsfeed.js");
|
||||||
});
|
});
|
||||||
|
|
||||||
test.skip('skip', () => {});
|
test.skip("skip", () => {});
|
||||||
});
|
});
|
||||||
|
@ -14,8 +14,7 @@ beforeAll(function () {
|
|||||||
__dirname: path.dirname(filePath),
|
__dirname: path.dirname(filePath),
|
||||||
global: {},
|
global: {},
|
||||||
process: {
|
process: {
|
||||||
on: function () {
|
on: function () {},
|
||||||
},
|
|
||||||
env: {}
|
env: {}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -14,8 +14,7 @@ beforeAll(function () {
|
|||||||
__dirname: path.dirname(filePath),
|
__dirname: path.dirname(filePath),
|
||||||
global: {},
|
global: {},
|
||||||
process: {
|
process: {
|
||||||
on: function () {
|
on: function () {},
|
||||||
},
|
|
||||||
env: {}
|
env: {}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user