mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-09-13 23:55:11 +00:00
Run prettier over ALL files once
No other changes done in this commit
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
{
|
||||
// Escaped
|
||||
"FOO\"BAR": "Today",
|
||||
// Escaped
|
||||
"FOO\"BAR": "Today",
|
||||
|
||||
/*
|
||||
* The following lines
|
||||
* represent cardinal directions
|
||||
*/
|
||||
"N": "N",
|
||||
"E": "E",
|
||||
"S": "S",
|
||||
"W": "W"
|
||||
/*
|
||||
* The following lines
|
||||
* represent cardinal directions
|
||||
*/
|
||||
"N": "N",
|
||||
"E": "E",
|
||||
"S": "S",
|
||||
"W": "W"
|
||||
}
|
||||
|
@@ -1,33 +1,33 @@
|
||||
{
|
||||
"LOADING": "Loading …",
|
||||
"LOADING": "Loading …",
|
||||
|
||||
"TODAY": "Today",
|
||||
"TOMORROW": "Tomorrow",
|
||||
"DAYAFTERTOMORROW": "In 2 days",
|
||||
"RUNNING": "Ends in",
|
||||
"EMPTY": "No upcoming events.",
|
||||
"TODAY": "Today",
|
||||
"TOMORROW": "Tomorrow",
|
||||
"DAYAFTERTOMORROW": "In 2 days",
|
||||
"RUNNING": "Ends in",
|
||||
"EMPTY": "No upcoming events.",
|
||||
|
||||
"WEEK": "Week {weekNumber}",
|
||||
"WEEK": "Week {weekNumber}",
|
||||
|
||||
"N": "N",
|
||||
"NNE": "NNE",
|
||||
"NE": "NE",
|
||||
"ENE": "ENE",
|
||||
"E": "E",
|
||||
"ESE": "ESE",
|
||||
"SE": "SE",
|
||||
"SSE": "SSE",
|
||||
"S": "S",
|
||||
"SSW": "SSW",
|
||||
"SW": "SW",
|
||||
"WSW": "WSW",
|
||||
"W": "W",
|
||||
"WNW": "WNW",
|
||||
"NW": "NW",
|
||||
"NNW": "NNW",
|
||||
"N": "N",
|
||||
"NNE": "NNE",
|
||||
"NE": "NE",
|
||||
"ENE": "ENE",
|
||||
"E": "E",
|
||||
"ESE": "ESE",
|
||||
"SE": "SE",
|
||||
"SSE": "SSE",
|
||||
"S": "S",
|
||||
"SSW": "SSW",
|
||||
"SW": "SW",
|
||||
"WSW": "WSW",
|
||||
"W": "W",
|
||||
"WNW": "WNW",
|
||||
"NW": "NW",
|
||||
"NNW": "NNW",
|
||||
|
||||
"UPDATE_NOTIFICATION": "MagicMirror² update available.",
|
||||
"UPDATE_NOTIFICATION_MODULE": "Update available for MODULE_NAME module.",
|
||||
"UPDATE_INFO_SINGLE": "The current installation is COMMIT_COUNT commit behind on the BRANCH_NAME branch.",
|
||||
"UPDATE_INFO_MULTIPLE": "The current installation is COMMIT_COUNT commits behind on the BRANCH_NAME branch."
|
||||
"UPDATE_NOTIFICATION": "MagicMirror² update available.",
|
||||
"UPDATE_NOTIFICATION_MODULE": "Update available for MODULE_NAME module.",
|
||||
"UPDATE_INFO_SINGLE": "The current installation is COMMIT_COUNT commit behind on the BRANCH_NAME branch.",
|
||||
"UPDATE_INFO_MULTIPLE": "The current installation is COMMIT_COUNT commits behind on the BRANCH_NAME branch."
|
||||
}
|
||||
|
@@ -1,33 +1,33 @@
|
||||
{
|
||||
"LOADING": "Loading …",
|
||||
"LOADING": "Loading …",
|
||||
|
||||
"TODAY": "Today",
|
||||
"TOMORROW": "Tomorrow",
|
||||
"DAYAFTERTOMORROW": "In 2 days",
|
||||
"RUNNING": "Ends in",
|
||||
"EMPTY": "No upcoming events.",
|
||||
"TODAY": "Today",
|
||||
"TOMORROW": "Tomorrow",
|
||||
"DAYAFTERTOMORROW": "In 2 days",
|
||||
"RUNNING": "Ends in",
|
||||
"EMPTY": "No upcoming events.",
|
||||
|
||||
"WEEK": "Week {weekNumber}",
|
||||
"WEEK": "Week {weekNumber}",
|
||||
|
||||
"N": "N",
|
||||
"NNE": "NNE",
|
||||
"NE": "NE",
|
||||
"ENE": "ENE",
|
||||
"E": "E",
|
||||
"ESE": "ESE",
|
||||
"SE": "SE",
|
||||
"SSE": "SSE",
|
||||
"S": "S",
|
||||
"SSW": "SSW",
|
||||
"SW": "SW",
|
||||
"WSW": "WSW",
|
||||
"W": "W",
|
||||
"WNW": "WNW",
|
||||
"NW": "NW",
|
||||
"NNW": "NNW",
|
||||
"N": "N",
|
||||
"NNE": "NNE",
|
||||
"NE": "NE",
|
||||
"ENE": "ENE",
|
||||
"E": "E",
|
||||
"ESE": "ESE",
|
||||
"SE": "SE",
|
||||
"SSE": "SSE",
|
||||
"S": "S",
|
||||
"SSW": "SSW",
|
||||
"SW": "SW",
|
||||
"WSW": "WSW",
|
||||
"W": "W",
|
||||
"WNW": "WNW",
|
||||
"NW": "NW",
|
||||
"NNW": "NNW",
|
||||
|
||||
"UPDATE_NOTIFICATION": "MagicMirror² update available.",
|
||||
"UPDATE_NOTIFICATION_MODULE": "Update available for MODULE_NAME module.",
|
||||
"UPDATE_INFO_SINGLE": "The current installation is COMMIT_COUNT commit behind on the BRANCH_NAME branch.",
|
||||
"UPDATE_INFO_MULTIPLE": "The current installation is COMMIT_COUNT commits behind on the BRANCH_NAME branch."
|
||||
"UPDATE_NOTIFICATION": "MagicMirror² update available.",
|
||||
"UPDATE_NOTIFICATION_MODULE": "Update available for MODULE_NAME module.",
|
||||
"UPDATE_INFO_SINGLE": "The current installation is COMMIT_COUNT commit behind on the BRANCH_NAME branch.",
|
||||
"UPDATE_INFO_MULTIPLE": "The current installation is COMMIT_COUNT commits behind on the BRANCH_NAME branch."
|
||||
}
|
||||
|
@@ -13,13 +13,14 @@ var config = {
|
||||
units: "metric",
|
||||
electronOptions: {
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
},
|
||||
nodeIntegration: true
|
||||
}
|
||||
},
|
||||
|
||||
modules: [
|
||||
]
|
||||
modules: []
|
||||
};
|
||||
|
||||
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||
if (typeof module !== "undefined") {module.exports = config;}
|
||||
if (typeof module !== "undefined") {
|
||||
module.exports = config;
|
||||
}
|
||||
|
@@ -13,13 +13,14 @@ var config = {
|
||||
units: "metric",
|
||||
electronOptions: {
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
},
|
||||
nodeIntegration: true
|
||||
}
|
||||
},
|
||||
|
||||
modules: [
|
||||
]
|
||||
modules: []
|
||||
};
|
||||
|
||||
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||
if (typeof module !== "undefined") {module.exports = config;}
|
||||
if (typeof module !== "undefined") {
|
||||
module.exports = config;
|
||||
}
|
||||
|
@@ -13,8 +13,8 @@ var config = {
|
||||
units: "metric",
|
||||
electronOptions: {
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
},
|
||||
nodeIntegration: true
|
||||
}
|
||||
},
|
||||
|
||||
modules: [
|
||||
@@ -38,4 +38,6 @@ var config = {
|
||||
};
|
||||
|
||||
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||
if (typeof module !== "undefined") {module.exports = config;}
|
||||
if (typeof module !== "undefined") {
|
||||
module.exports = config;
|
||||
}
|
||||
|
@@ -13,8 +13,8 @@ var config = {
|
||||
units: "metric",
|
||||
electronOptions: {
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
},
|
||||
nodeIntegration: true
|
||||
}
|
||||
},
|
||||
|
||||
modules: [
|
||||
@@ -39,4 +39,6 @@ var config = {
|
||||
};
|
||||
|
||||
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||
if (typeof module !== "undefined") {module.exports = config;}
|
||||
if (typeof module !== "undefined") {
|
||||
module.exports = config;
|
||||
}
|
||||
|
@@ -13,8 +13,8 @@ var config = {
|
||||
units: "metric",
|
||||
electronOptions: {
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
},
|
||||
nodeIntegration: true
|
||||
}
|
||||
},
|
||||
|
||||
modules: [
|
||||
@@ -34,4 +34,6 @@ var config = {
|
||||
};
|
||||
|
||||
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||
if (typeof module !== "undefined") {module.exports = config;}
|
||||
if (typeof module !== "undefined") {
|
||||
module.exports = config;
|
||||
}
|
||||
|
@@ -15,8 +15,8 @@ var config = {
|
||||
units: "metric",
|
||||
electronOptions: {
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
},
|
||||
nodeIntegration: true
|
||||
}
|
||||
},
|
||||
|
||||
modules: [
|
||||
@@ -41,4 +41,6 @@ var config = {
|
||||
};
|
||||
|
||||
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||
if (typeof module !== "undefined") {module.exports = config;}
|
||||
if (typeof module !== "undefined") {
|
||||
module.exports = config;
|
||||
}
|
||||
|
@@ -13,8 +13,8 @@ var config = {
|
||||
units: "metric",
|
||||
electronOptions: {
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
},
|
||||
nodeIntegration: true
|
||||
}
|
||||
},
|
||||
|
||||
modules: [
|
||||
@@ -36,4 +36,6 @@ var config = {
|
||||
};
|
||||
|
||||
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||
if (typeof module !== "undefined") {module.exports = config;}
|
||||
if (typeof module !== "undefined") {
|
||||
module.exports = config;
|
||||
}
|
||||
|
@@ -13,8 +13,8 @@ var config = {
|
||||
units: "metric",
|
||||
electronOptions: {
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
},
|
||||
nodeIntegration: true
|
||||
}
|
||||
},
|
||||
|
||||
modules: [
|
||||
@@ -26,4 +26,6 @@ var config = {
|
||||
};
|
||||
|
||||
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||
if (typeof module !== "undefined") {module.exports = config;}
|
||||
if (typeof module !== "undefined") {
|
||||
module.exports = config;
|
||||
}
|
||||
|
@@ -13,8 +13,8 @@ var config = {
|
||||
units: "metric",
|
||||
electronOptions: {
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
},
|
||||
nodeIntegration: true
|
||||
}
|
||||
},
|
||||
|
||||
modules: [
|
||||
@@ -26,4 +26,6 @@ var config = {
|
||||
};
|
||||
|
||||
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||
if (typeof module !== "undefined") {module.exports = config;}
|
||||
if (typeof module !== "undefined") {
|
||||
module.exports = config;
|
||||
}
|
||||
|
@@ -13,8 +13,8 @@ var config = {
|
||||
units: "metric",
|
||||
electronOptions: {
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
},
|
||||
nodeIntegration: true
|
||||
}
|
||||
},
|
||||
|
||||
modules: [
|
||||
@@ -29,4 +29,6 @@ var config = {
|
||||
};
|
||||
|
||||
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||
if (typeof module !== "undefined") {module.exports = config;}
|
||||
if (typeof module !== "undefined") {
|
||||
module.exports = config;
|
||||
}
|
||||
|
@@ -13,8 +13,8 @@ var config = {
|
||||
units: "metric",
|
||||
electronOptions: {
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
},
|
||||
nodeIntegration: true
|
||||
}
|
||||
},
|
||||
|
||||
modules: [
|
||||
@@ -29,4 +29,6 @@ var config = {
|
||||
};
|
||||
|
||||
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||
if (typeof module !== "undefined") {module.exports = config;}
|
||||
if (typeof module !== "undefined") {
|
||||
module.exports = config;
|
||||
}
|
||||
|
@@ -13,8 +13,8 @@ var config = {
|
||||
units: "metric",
|
||||
electronOptions: {
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
},
|
||||
nodeIntegration: true
|
||||
}
|
||||
},
|
||||
|
||||
modules: [
|
||||
@@ -29,4 +29,6 @@ var config = {
|
||||
};
|
||||
|
||||
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||
if (typeof module !== "undefined") {module.exports = config;}
|
||||
if (typeof module !== "undefined") {
|
||||
module.exports = config;
|
||||
}
|
||||
|
@@ -13,8 +13,8 @@ var config = {
|
||||
units: "metric",
|
||||
electronOptions: {
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
},
|
||||
nodeIntegration: true
|
||||
}
|
||||
},
|
||||
|
||||
modules: [
|
||||
@@ -26,4 +26,6 @@ var config = {
|
||||
};
|
||||
|
||||
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||
if (typeof module !== "undefined") {module.exports = config;}
|
||||
if (typeof module !== "undefined") {
|
||||
module.exports = config;
|
||||
}
|
||||
|
@@ -13,8 +13,8 @@ var config = {
|
||||
units: "metric",
|
||||
electronOptions: {
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
},
|
||||
nodeIntegration: true
|
||||
}
|
||||
},
|
||||
|
||||
modules: [
|
||||
@@ -26,4 +26,6 @@ var config = {
|
||||
};
|
||||
|
||||
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||
if (typeof module !== "undefined") {module.exports = config;}
|
||||
if (typeof module !== "undefined") {
|
||||
module.exports = config;
|
||||
}
|
||||
|
@@ -13,8 +13,8 @@ var config = {
|
||||
units: "metric",
|
||||
electronOptions: {
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
},
|
||||
nodeIntegration: true
|
||||
}
|
||||
},
|
||||
|
||||
modules: [
|
||||
@@ -29,4 +29,6 @@ var config = {
|
||||
};
|
||||
|
||||
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||
if (typeof module !== "undefined") {module.exports = config;}
|
||||
if (typeof module !== "undefined") {
|
||||
module.exports = config;
|
||||
}
|
||||
|
@@ -16,8 +16,8 @@ var config = {
|
||||
units: "metric",
|
||||
electronOptions: {
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
},
|
||||
nodeIntegration: true
|
||||
}
|
||||
},
|
||||
|
||||
modules: [
|
||||
@@ -32,4 +32,6 @@ var config = {
|
||||
};
|
||||
|
||||
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||
if (typeof module !== "undefined") {module.exports = config;}
|
||||
if (typeof module !== "undefined") {
|
||||
module.exports = config;
|
||||
}
|
||||
|
@@ -13,8 +13,8 @@ var config = {
|
||||
units: "metric",
|
||||
electronOptions: {
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
},
|
||||
nodeIntegration: true
|
||||
}
|
||||
},
|
||||
|
||||
modules: [
|
||||
@@ -27,7 +27,6 @@ var config = {
|
||||
afternoon: [],
|
||||
evening: [],
|
||||
anytime: ["Anytime here"]
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -35,4 +34,6 @@ var config = {
|
||||
};
|
||||
|
||||
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||
if (typeof module !== "undefined") {module.exports = config;}
|
||||
if (typeof module !== "undefined") {
|
||||
module.exports = config;
|
||||
}
|
||||
|
@@ -14,8 +14,8 @@ let config = {
|
||||
units: "metric",
|
||||
electronOptions: {
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
},
|
||||
nodeIntegration: true
|
||||
}
|
||||
},
|
||||
|
||||
modules: [
|
||||
@@ -28,9 +28,7 @@ let config = {
|
||||
morning: [],
|
||||
afternoon: [],
|
||||
evening: [],
|
||||
"....-01-01": [
|
||||
"Happy new year!"
|
||||
]
|
||||
"....-01-01": ["Happy new year!"]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -38,4 +36,6 @@ let config = {
|
||||
};
|
||||
|
||||
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||
if (typeof module !== "undefined") {module.exports = config;}
|
||||
if (typeof module !== "undefined") {
|
||||
module.exports = config;
|
||||
}
|
||||
|
@@ -13,8 +13,8 @@ var config = {
|
||||
units: "metric",
|
||||
electronOptions: {
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
},
|
||||
nodeIntegration: true
|
||||
}
|
||||
},
|
||||
|
||||
modules: [
|
||||
@@ -24,7 +24,6 @@ var config = {
|
||||
config: {
|
||||
compliments: {
|
||||
anytime: ["Anytime here"]
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,4 +31,6 @@ var config = {
|
||||
};
|
||||
|
||||
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||
if (typeof module !== "undefined") {module.exports = config;}
|
||||
if (typeof module !== "undefined") {
|
||||
module.exports = config;
|
||||
}
|
||||
|
@@ -13,8 +13,8 @@ var config = {
|
||||
units: "metric",
|
||||
electronOptions: {
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
},
|
||||
nodeIntegration: true
|
||||
}
|
||||
},
|
||||
|
||||
modules: [
|
||||
@@ -23,15 +23,9 @@ var config = {
|
||||
position: "middle_center",
|
||||
config: {
|
||||
compliments: {
|
||||
morning: [
|
||||
"Hi", "Good Morning", "Morning test"
|
||||
],
|
||||
afternoon: [
|
||||
"Hello", "Good Afternoon", "Afternoon test"
|
||||
],
|
||||
evening: [
|
||||
"Hello There", "Good Evening", "Evening test"
|
||||
]
|
||||
morning: ["Hi", "Good Morning", "Morning test"],
|
||||
afternoon: ["Hello", "Good Afternoon", "Afternoon test"],
|
||||
evening: ["Hello There", "Good Evening", "Evening test"]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,4 +33,6 @@ var config = {
|
||||
};
|
||||
|
||||
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||
if (typeof module !== "undefined") {module.exports = config;}
|
||||
if (typeof module !== "undefined") {
|
||||
module.exports = config;
|
||||
}
|
||||
|
@@ -13,8 +13,8 @@ var config = {
|
||||
units: "metric",
|
||||
electronOptions: {
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
},
|
||||
nodeIntegration: true
|
||||
}
|
||||
},
|
||||
|
||||
modules: [
|
||||
@@ -29,4 +29,6 @@ var config = {
|
||||
};
|
||||
|
||||
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||
if (typeof module !== "undefined") {module.exports = config;}
|
||||
if (typeof module !== "undefined") {
|
||||
module.exports = config;
|
||||
}
|
||||
|
@@ -13,8 +13,8 @@ var config = {
|
||||
units: "metric",
|
||||
electronOptions: {
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
},
|
||||
nodeIntegration: true
|
||||
}
|
||||
},
|
||||
|
||||
modules: [
|
||||
@@ -26,4 +26,6 @@ var config = {
|
||||
};
|
||||
|
||||
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||
if (typeof module !== "undefined") {module.exports = config;}
|
||||
if (typeof module !== "undefined") {
|
||||
module.exports = config;
|
||||
}
|
||||
|
@@ -13,13 +13,12 @@ var config = {
|
||||
units: "metric",
|
||||
electronOptions: {
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
},
|
||||
nodeIntegration: true
|
||||
}
|
||||
},
|
||||
|
||||
modules: [
|
||||
{
|
||||
|
||||
module: "newsfeed",
|
||||
position: "bottom_bar",
|
||||
config: {
|
||||
@@ -27,7 +26,7 @@ var config = {
|
||||
{
|
||||
title: "Rodrigo Ramirez Blog",
|
||||
url: "http://localhost:8080/tests/configs/data/feed_test_rodrigoramirez.xml"
|
||||
},
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -35,4 +34,6 @@ var config = {
|
||||
};
|
||||
|
||||
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||
if (typeof module !== "undefined") {module.exports = config;}
|
||||
if (typeof module !== "undefined") {
|
||||
module.exports = config;
|
||||
}
|
||||
|
@@ -15,16 +15,14 @@ var config = {
|
||||
units: "metric",
|
||||
electronOptions: {
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
},
|
||||
nodeIntegration: true
|
||||
}
|
||||
},
|
||||
|
||||
modules:
|
||||
// Using exotic content. This is why dont accept go to JSON configuration file
|
||||
(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"];
|
||||
(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"];
|
||||
var modules = Array();
|
||||
for (var idx in positions) {
|
||||
modules.push({
|
||||
@@ -36,7 +34,9 @@ var config = {
|
||||
});
|
||||
}
|
||||
return modules;
|
||||
})(),
|
||||
})()
|
||||
};
|
||||
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||
if (typeof module !== "undefined") {module.exports = config;}
|
||||
if (typeof module !== "undefined") {
|
||||
module.exports = config;
|
||||
}
|
||||
|
@@ -14,8 +14,8 @@ let config = {
|
||||
units: "metric",
|
||||
electronOptions: {
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
},
|
||||
nodeIntegration: true
|
||||
}
|
||||
},
|
||||
|
||||
modules: [
|
||||
@@ -32,4 +32,6 @@ let config = {
|
||||
};
|
||||
|
||||
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||
if (typeof module !== "undefined") {module.exports = config;}
|
||||
if (typeof module !== "undefined") {
|
||||
module.exports = config;
|
||||
}
|
||||
|
@@ -14,8 +14,8 @@ let config = {
|
||||
units: "metric",
|
||||
electronOptions: {
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
},
|
||||
nodeIntegration: true
|
||||
}
|
||||
},
|
||||
|
||||
modules: [
|
||||
@@ -37,4 +37,6 @@ let config = {
|
||||
};
|
||||
|
||||
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||
if (typeof module !== "undefined") {module.exports = config;}
|
||||
if (typeof module !== "undefined") {
|
||||
module.exports = config;
|
||||
}
|
||||
|
@@ -14,8 +14,8 @@ let config = {
|
||||
units: "imperial",
|
||||
electronOptions: {
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
},
|
||||
nodeIntegration: true
|
||||
}
|
||||
},
|
||||
|
||||
modules: [
|
||||
@@ -34,4 +34,6 @@ let config = {
|
||||
};
|
||||
|
||||
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||
if (typeof module !== "undefined") {module.exports = config;}
|
||||
if (typeof module !== "undefined") {
|
||||
module.exports = config;
|
||||
}
|
||||
|
@@ -14,8 +14,8 @@ let config = {
|
||||
units: "metric",
|
||||
electronOptions: {
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
},
|
||||
nodeIntegration: true
|
||||
}
|
||||
},
|
||||
|
||||
modules: [
|
||||
@@ -34,4 +34,6 @@ let config = {
|
||||
};
|
||||
|
||||
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||
if (typeof module !== "undefined") {module.exports = config;}
|
||||
if (typeof module !== "undefined") {
|
||||
module.exports = config;
|
||||
}
|
||||
|
@@ -14,8 +14,8 @@ let config = {
|
||||
units: "metric",
|
||||
electronOptions: {
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
},
|
||||
nodeIntegration: true
|
||||
}
|
||||
},
|
||||
|
||||
modules: [
|
||||
@@ -37,4 +37,6 @@ let config = {
|
||||
};
|
||||
|
||||
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||
if (typeof module !== "undefined") {module.exports = config;}
|
||||
if (typeof module !== "undefined") {
|
||||
module.exports = config;
|
||||
}
|
||||
|
@@ -13,13 +13,14 @@ var config = {
|
||||
units: "metric",
|
||||
electronOptions: {
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
},
|
||||
nodeIntegration: true
|
||||
}
|
||||
},
|
||||
|
||||
modules: [
|
||||
]
|
||||
modules: []
|
||||
};
|
||||
|
||||
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||
if (typeof module !== "undefined") {module.exports = config;}
|
||||
if (typeof module !== "undefined") {
|
||||
module.exports = config;
|
||||
}
|
||||
|
@@ -13,13 +13,14 @@ var config = {
|
||||
units: "metric",
|
||||
electronOptions: {
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
},
|
||||
nodeIntegration: true
|
||||
}
|
||||
},
|
||||
|
||||
modules: [
|
||||
]
|
||||
modules: []
|
||||
};
|
||||
|
||||
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||
if (typeof module !== "undefined") {module.exports = config;}
|
||||
if (typeof module !== "undefined") {
|
||||
module.exports = config;
|
||||
}
|
||||
|
@@ -13,11 +13,12 @@ var config = {
|
||||
units: "metric",
|
||||
electronOptions: {
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
},
|
||||
nodeIntegration: true
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||
if (typeof module !== "undefined") {module.exports = config;}
|
||||
if (typeof module !== "undefined") {
|
||||
module.exports = config;
|
||||
}
|
||||
|
@@ -4,7 +4,7 @@ const expect = require("chai").expect;
|
||||
const describe = global.describe;
|
||||
const it = global.it;
|
||||
|
||||
describe("Development console tests", function() {
|
||||
describe("Development console tests", function () {
|
||||
// FIXME: This tests fail and crash another tests
|
||||
// Suspect problem with window focus
|
||||
return false;
|
||||
@@ -14,47 +14,47 @@ describe("Development console tests", function() {
|
||||
|
||||
var app = null;
|
||||
|
||||
before(function() {
|
||||
before(function () {
|
||||
// Set config sample for use in test
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/env.js";
|
||||
});
|
||||
|
||||
describe("Without 'dev' commandline argument", function() {
|
||||
before(function() {
|
||||
describe("Without 'dev' commandline argument", function () {
|
||||
before(function () {
|
||||
return helpers
|
||||
.startApplication({
|
||||
args: ["js/electron.js"]
|
||||
})
|
||||
.then(function(startedApp) {
|
||||
.then(function (startedApp) {
|
||||
app = startedApp;
|
||||
});
|
||||
});
|
||||
|
||||
after(function() {
|
||||
after(function () {
|
||||
return helpers.stopApplication(app);
|
||||
});
|
||||
|
||||
it("should not open dev console when absent", function() {
|
||||
it("should not open dev console when absent", function () {
|
||||
return expect(app.browserWindow.isDevToolsOpened()).to.eventually.equal(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("With 'dev' commandline argument", function() {
|
||||
before(function() {
|
||||
describe("With 'dev' commandline argument", function () {
|
||||
before(function () {
|
||||
return helpers
|
||||
.startApplication({
|
||||
args: ["js/electron.js", "dev"]
|
||||
})
|
||||
.then(function(startedApp) {
|
||||
.then(function (startedApp) {
|
||||
app = startedApp;
|
||||
});
|
||||
});
|
||||
|
||||
after(function() {
|
||||
after(function () {
|
||||
return helpers.stopApplication(app);
|
||||
});
|
||||
|
||||
it("should open dev console when provided", function() {
|
||||
it("should open dev console when provided", function () {
|
||||
return expect(app.browserWindow.isDevToolsOpened()).to.eventually.equal(true);
|
||||
});
|
||||
});
|
||||
|
@@ -7,59 +7,61 @@ const it = global.it;
|
||||
const beforeEach = global.beforeEach;
|
||||
const afterEach = global.afterEach;
|
||||
|
||||
describe("Electron app environment", function() {
|
||||
describe("Electron app environment", function () {
|
||||
helpers.setupTimeout(this);
|
||||
|
||||
var app = null;
|
||||
|
||||
before(function() {
|
||||
before(function () {
|
||||
// Set config sample for use in test
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/env.js";
|
||||
});
|
||||
|
||||
beforeEach(function() {
|
||||
beforeEach(function () {
|
||||
return helpers
|
||||
.startApplication({
|
||||
args: ["js/electron.js"]
|
||||
})
|
||||
.then(function(startedApp) {
|
||||
.then(function (startedApp) {
|
||||
app = startedApp;
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
afterEach(function () {
|
||||
return helpers.stopApplication(app);
|
||||
});
|
||||
|
||||
it("should open a browserwindow", function() {
|
||||
return app.client
|
||||
.waitUntilWindowLoaded()
|
||||
// .browserWindow.focus()
|
||||
.getWindowCount()
|
||||
.should.eventually.equal(1)
|
||||
.browserWindow.isMinimized()
|
||||
.should.eventually.be.false.browserWindow.isDevToolsOpened()
|
||||
.should.eventually.be.false.browserWindow.isVisible()
|
||||
.should.eventually.be.true.browserWindow.isFocused()
|
||||
.should.eventually.be.true.browserWindow.getBounds()
|
||||
.should.eventually.have.property("width")
|
||||
.and.be.above(0)
|
||||
.browserWindow.getBounds()
|
||||
.should.eventually.have.property("height")
|
||||
.and.be.above(0)
|
||||
.browserWindow.getTitle()
|
||||
.should.eventually.equal("MagicMirror²");
|
||||
it("should open a browserwindow", function () {
|
||||
return (
|
||||
app.client
|
||||
.waitUntilWindowLoaded()
|
||||
// .browserWindow.focus()
|
||||
.getWindowCount()
|
||||
.should.eventually.equal(1)
|
||||
.browserWindow.isMinimized()
|
||||
.should.eventually.be.false.browserWindow.isDevToolsOpened()
|
||||
.should.eventually.be.false.browserWindow.isVisible()
|
||||
.should.eventually.be.true.browserWindow.isFocused()
|
||||
.should.eventually.be.true.browserWindow.getBounds()
|
||||
.should.eventually.have.property("width")
|
||||
.and.be.above(0)
|
||||
.browserWindow.getBounds()
|
||||
.should.eventually.have.property("height")
|
||||
.and.be.above(0)
|
||||
.browserWindow.getTitle()
|
||||
.should.eventually.equal("MagicMirror²")
|
||||
);
|
||||
});
|
||||
|
||||
it("get request from http://localhost:8080 should return 200", function(done) {
|
||||
request.get("http://localhost:8080", function(err, res, body) {
|
||||
it("get request from http://localhost:8080 should return 200", function (done) {
|
||||
request.get("http://localhost:8080", function (err, res, body) {
|
||||
expect(res.statusCode).to.equal(200);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it("get request from http://localhost:8080/nothing should return 404", function(done) {
|
||||
request.get("http://localhost:8080/nothing", function(err, res, body) {
|
||||
it("get request from http://localhost:8080/nothing should return 404", function (done) {
|
||||
request.get("http://localhost:8080/nothing", function (err, res, body) {
|
||||
expect(res.statusCode).to.equal(404);
|
||||
done();
|
||||
});
|
||||
|
@@ -5,7 +5,7 @@ const forEach = require("mocha-each");
|
||||
|
||||
const describe = global.describe;
|
||||
|
||||
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);
|
||||
|
||||
var app;
|
||||
@@ -21,7 +21,7 @@ describe("All font files from roboto.css should be downloadable", function() {
|
||||
match = regex.exec(fileContent);
|
||||
}
|
||||
|
||||
before(function() {
|
||||
before(function () {
|
||||
// Set config sample for use in test
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/without_modules.js";
|
||||
|
||||
@@ -29,18 +29,18 @@ describe("All font files from roboto.css should be downloadable", function() {
|
||||
.startApplication({
|
||||
args: ["js/electron.js"]
|
||||
})
|
||||
.then(function(startedApp) {
|
||||
.then(function (startedApp) {
|
||||
app = startedApp;
|
||||
});
|
||||
});
|
||||
|
||||
after(function() {
|
||||
after(function () {
|
||||
return helpers.stopApplication(app);
|
||||
});
|
||||
|
||||
forEach(fontFiles).it("should return 200 HTTP code for file '%s'", (fontFile, done) => {
|
||||
var fontUrl = "http://localhost:8080/fonts/" + fontFile;
|
||||
request.get(fontUrl, function(err, res, body) {
|
||||
request.get(fontUrl, function (err, res, body) {
|
||||
expect(res.statusCode).to.equal(200);
|
||||
done();
|
||||
});
|
||||
|
@@ -6,7 +6,7 @@
|
||||
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
|
||||
* MIT Licensed.
|
||||
*
|
||||
*/
|
||||
*/
|
||||
|
||||
const Application = require("spectron").Application;
|
||||
const assert = require("assert");
|
||||
@@ -14,12 +14,12 @@ const chai = require("chai");
|
||||
const chaiAsPromised = require("chai-as-promised");
|
||||
const path = require("path");
|
||||
|
||||
global.before(function() {
|
||||
global.before(function () {
|
||||
chai.should();
|
||||
chai.use(chaiAsPromised);
|
||||
});
|
||||
|
||||
exports.getElectronPath = function() {
|
||||
exports.getElectronPath = function () {
|
||||
var electronPath = path.join(__dirname, "..", "..", "node_modules", ".bin", "electron");
|
||||
if (process.platform === "win32") {
|
||||
electronPath += ".cmd";
|
||||
@@ -28,7 +28,7 @@ exports.getElectronPath = function() {
|
||||
};
|
||||
|
||||
// Set timeout - if this is run within Travis, increase timeout
|
||||
exports.setupTimeout = function(test) {
|
||||
exports.setupTimeout = function (test) {
|
||||
if (process.env.CI) {
|
||||
test.timeout(30000);
|
||||
} else {
|
||||
@@ -36,26 +36,26 @@ exports.setupTimeout = function(test) {
|
||||
}
|
||||
};
|
||||
|
||||
exports.startApplication = function(options) {
|
||||
exports.startApplication = function (options) {
|
||||
options.path = exports.getElectronPath();
|
||||
if (process.env.CI) {
|
||||
options.startTimeout = 30000;
|
||||
}
|
||||
|
||||
var app = new Application(options);
|
||||
return app.start().then(function() {
|
||||
return app.start().then(function () {
|
||||
assert.equal(app.isRunning(), true);
|
||||
chaiAsPromised.transferPromiseness = app.transferPromiseness;
|
||||
return app;
|
||||
});
|
||||
};
|
||||
|
||||
exports.stopApplication = function(app) {
|
||||
exports.stopApplication = function (app) {
|
||||
if (!app || !app.isRunning()) {
|
||||
return;
|
||||
}
|
||||
|
||||
return app.stop().then(function() {
|
||||
return app.stop().then(function () {
|
||||
assert.equal(app.isRunning(), false);
|
||||
});
|
||||
};
|
||||
|
@@ -13,9 +13,13 @@ describe("ipWhitelist directive configuration", function () {
|
||||
var app = null;
|
||||
|
||||
beforeEach(function () {
|
||||
return helpers.startApplication({
|
||||
args: ["js/electron.js"]
|
||||
}).then(function (startedApp) { app = startedApp; });
|
||||
return helpers
|
||||
.startApplication({
|
||||
args: ["js/electron.js"]
|
||||
})
|
||||
.then(function (startedApp) {
|
||||
app = startedApp;
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(function () {
|
||||
@@ -47,5 +51,4 @@ describe("ipWhitelist directive configuration", function () {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
@@ -6,96 +6,96 @@ const it = global.it;
|
||||
const beforeEach = global.beforeEach;
|
||||
const afterEach = global.afterEach;
|
||||
|
||||
describe("Calendar module", function() {
|
||||
describe("Calendar module", function () {
|
||||
helpers.setupTimeout(this);
|
||||
|
||||
var app = null;
|
||||
|
||||
beforeEach(function() {
|
||||
beforeEach(function () {
|
||||
return helpers
|
||||
.startApplication({
|
||||
args: ["js/electron.js"]
|
||||
})
|
||||
.then(function(startedApp) {
|
||||
.then(function (startedApp) {
|
||||
app = startedApp;
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
afterEach(function () {
|
||||
return helpers.stopApplication(app);
|
||||
});
|
||||
|
||||
describe("Default configuration", function() {
|
||||
before(function() {
|
||||
describe("Default configuration", function () {
|
||||
before(function () {
|
||||
// Set config sample for use in test
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/calendar/default.js";
|
||||
});
|
||||
|
||||
it("Should return TestEvents", function() {
|
||||
it("Should return TestEvents", function () {
|
||||
return app.client.waitUntilTextExists(".calendar", "TestEvent", 10000);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Basic auth", function() {
|
||||
before(function() {
|
||||
describe("Basic auth", function () {
|
||||
before(function () {
|
||||
serverBasicAuth.listen(8010);
|
||||
// Set config sample for use in test
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/calendar/basic-auth.js";
|
||||
});
|
||||
|
||||
after(function(done) {
|
||||
after(function (done) {
|
||||
serverBasicAuth.close(done());
|
||||
});
|
||||
|
||||
it("Should return TestEvents", function() {
|
||||
it("Should return TestEvents", function () {
|
||||
return app.client.waitUntilTextExists(".calendar", "TestEvent", 10000);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Basic auth by default", function() {
|
||||
before(function() {
|
||||
describe("Basic auth by default", function () {
|
||||
before(function () {
|
||||
serverBasicAuth.listen(8011);
|
||||
// Set config sample for use in test
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/calendar/auth-default.js";
|
||||
});
|
||||
|
||||
after(function(done) {
|
||||
after(function (done) {
|
||||
serverBasicAuth.close(done());
|
||||
});
|
||||
|
||||
it("Should return TestEvents", function() {
|
||||
it("Should return TestEvents", function () {
|
||||
return app.client.waitUntilTextExists(".calendar", "TestEvent", 10000);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Basic auth backward compatibility configuration: DEPRECATED", function() {
|
||||
before(function() {
|
||||
describe("Basic auth backward compatibility configuration: DEPRECATED", function () {
|
||||
before(function () {
|
||||
serverBasicAuth.listen(8012);
|
||||
// Set config sample for use in test
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/calendar/old-basic-auth.js";
|
||||
});
|
||||
|
||||
after(function(done) {
|
||||
after(function (done) {
|
||||
serverBasicAuth.close(done());
|
||||
});
|
||||
|
||||
it("Should return TestEvents", function() {
|
||||
it("Should return TestEvents", function () {
|
||||
return app.client.waitUntilTextExists(".calendar", "TestEvent", 10000);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Fail Basic auth", function() {
|
||||
before(function() {
|
||||
describe("Fail Basic auth", function () {
|
||||
before(function () {
|
||||
serverBasicAuth.listen(8020);
|
||||
// Set config sample for use in test
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/calendar/fail-basic-auth.js";
|
||||
});
|
||||
|
||||
after(function(done) {
|
||||
after(function (done) {
|
||||
serverBasicAuth.close(done());
|
||||
});
|
||||
|
||||
it("Should return No upcoming events", function() {
|
||||
it("Should return No upcoming events", function () {
|
||||
return app.client.waitUntilTextExists(".calendar", "No upcoming events.", 10000);
|
||||
});
|
||||
});
|
||||
|
@@ -5,81 +5,80 @@ const it = global.it;
|
||||
const beforeEach = global.beforeEach;
|
||||
const afterEach = global.afterEach;
|
||||
|
||||
describe("Clock set to spanish language module", function() {
|
||||
describe("Clock set to spanish language module", function () {
|
||||
helpers.setupTimeout(this);
|
||||
|
||||
var app = null;
|
||||
|
||||
beforeEach(function() {
|
||||
beforeEach(function () {
|
||||
return helpers
|
||||
.startApplication({
|
||||
args: ["js/electron.js"]
|
||||
})
|
||||
.then(function(startedApp) {
|
||||
.then(function (startedApp) {
|
||||
app = startedApp;
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
afterEach(function () {
|
||||
return helpers.stopApplication(app);
|
||||
});
|
||||
|
||||
describe("with default 24hr clock config", function() {
|
||||
before(function() {
|
||||
describe("with default 24hr clock config", function () {
|
||||
before(function () {
|
||||
// Set config sample for use in test
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/clock/es/clock_24hr.js";
|
||||
});
|
||||
|
||||
it("shows date with correct format", function() {
|
||||
it("shows date with correct format", function () {
|
||||
const dateRegex = /^(?:lunes|martes|miércoles|jueves|viernes|sábado|domingo), \d{1,2} de (?:enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre) de \d{4}$/;
|
||||
return app.client.waitUntilWindowLoaded().getText(".clock .date").should.eventually.match(dateRegex);
|
||||
});
|
||||
|
||||
it("shows time in 24hr format", function() {
|
||||
it("shows time in 24hr format", function () {
|
||||
const timeRegex = /^(?:2[0-3]|[01]\d):[0-5]\d[0-5]\d$/;
|
||||
return app.client.waitUntilWindowLoaded().getText(".clock .time").should.eventually.match(timeRegex);
|
||||
});
|
||||
});
|
||||
|
||||
describe("with default 12hr clock config", function() {
|
||||
before(function() {
|
||||
describe("with default 12hr clock config", function () {
|
||||
before(function () {
|
||||
// Set config sample for use in test
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/clock/es/clock_12hr.js";
|
||||
});
|
||||
|
||||
it("shows date with correct format", function() {
|
||||
it("shows date with correct format", function () {
|
||||
const dateRegex = /^(?:lunes|martes|miércoles|jueves|viernes|sábado|domingo), \d{1,2} de (?:enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre) de \d{4}$/;
|
||||
return app.client.waitUntilWindowLoaded().getText(".clock .date").should.eventually.match(dateRegex);
|
||||
});
|
||||
|
||||
it("shows time in 12hr format", function() {
|
||||
it("shows time in 12hr format", function () {
|
||||
const timeRegex = /^(?:1[0-2]|[1-9]):[0-5]\d[0-5]\d[ap]m$/;
|
||||
return app.client.waitUntilWindowLoaded().getText(".clock .time").should.eventually.match(timeRegex);
|
||||
});
|
||||
});
|
||||
|
||||
describe("with showPeriodUpper config enabled", function() {
|
||||
before(function() {
|
||||
describe("with showPeriodUpper config enabled", function () {
|
||||
before(function () {
|
||||
// Set config sample for use in test
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/clock/es/clock_showPeriodUpper.js";
|
||||
});
|
||||
|
||||
it("shows 12hr time with upper case AM/PM", function() {
|
||||
it("shows 12hr time with upper case AM/PM", function () {
|
||||
const timeRegex = /^(?:1[0-2]|[1-9]):[0-5]\d[0-5]\d[AP]M$/;
|
||||
return app.client.waitUntilWindowLoaded().getText(".clock .time").should.eventually.match(timeRegex);
|
||||
});
|
||||
});
|
||||
|
||||
describe("with showWeek config enabled", function() {
|
||||
before(function() {
|
||||
describe("with showWeek config enabled", function () {
|
||||
before(function () {
|
||||
// Set config sample for use in test
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/clock/es/clock_showWeek.js";
|
||||
});
|
||||
|
||||
it("shows week with correct format", function() {
|
||||
it("shows week with correct format", function () {
|
||||
const weekRegex = /^Semana [0-9]{1,2}$/;
|
||||
return app.client.waitUntilWindowLoaded()
|
||||
.getText(".clock .week").should.eventually.match(weekRegex);
|
||||
return app.client.waitUntilWindowLoaded().getText(".clock .week").should.eventually.match(weekRegex);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@@ -5,95 +5,95 @@ const it = global.it;
|
||||
const beforeEach = global.beforeEach;
|
||||
const afterEach = global.afterEach;
|
||||
|
||||
describe("Clock module", function() {
|
||||
describe("Clock module", function () {
|
||||
helpers.setupTimeout(this);
|
||||
|
||||
var app = null;
|
||||
|
||||
beforeEach(function() {
|
||||
beforeEach(function () {
|
||||
return helpers
|
||||
.startApplication({
|
||||
args: ["js/electron.js"]
|
||||
})
|
||||
.then(function(startedApp) {
|
||||
.then(function (startedApp) {
|
||||
app = startedApp;
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
afterEach(function () {
|
||||
return helpers.stopApplication(app);
|
||||
});
|
||||
|
||||
describe("with default 24hr clock config", function() {
|
||||
before(function() {
|
||||
describe("with default 24hr clock config", function () {
|
||||
before(function () {
|
||||
// Set config sample for use in test
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/clock/clock_24hr.js";
|
||||
});
|
||||
|
||||
it("shows date with correct format", function() {
|
||||
it("shows date with correct format", function () {
|
||||
const dateRegex = /^(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (?:January|February|March|April|May|June|July|August|September|October|November|December) \d{1,2}, \d{4}$/;
|
||||
return app.client.waitUntilWindowLoaded().getText(".clock .date").should.eventually.match(dateRegex);
|
||||
});
|
||||
|
||||
it("shows time in 24hr format", function() {
|
||||
it("shows time in 24hr format", function () {
|
||||
const timeRegex = /^(?:2[0-3]|[01]\d):[0-5]\d[0-5]\d$/;
|
||||
return app.client.waitUntilWindowLoaded().getText(".clock .time").should.eventually.match(timeRegex);
|
||||
});
|
||||
});
|
||||
|
||||
describe("with default 12hr clock config", function() {
|
||||
before(function() {
|
||||
describe("with default 12hr clock config", function () {
|
||||
before(function () {
|
||||
// Set config sample for use in test
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/clock/clock_12hr.js";
|
||||
});
|
||||
|
||||
it("shows date with correct format", function() {
|
||||
it("shows date with correct format", function () {
|
||||
const dateRegex = /^(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (?:January|February|March|April|May|June|July|August|September|October|November|December) \d{1,2}, \d{4}$/;
|
||||
return app.client.waitUntilWindowLoaded().getText(".clock .date").should.eventually.match(dateRegex);
|
||||
});
|
||||
|
||||
it("shows time in 12hr format", function() {
|
||||
it("shows time in 12hr format", function () {
|
||||
const timeRegex = /^(?:1[0-2]|[1-9]):[0-5]\d[0-5]\d[ap]m$/;
|
||||
return app.client.waitUntilWindowLoaded().getText(".clock .time").should.eventually.match(timeRegex);
|
||||
});
|
||||
});
|
||||
|
||||
describe("with showPeriodUpper config enabled", function() {
|
||||
before(function() {
|
||||
describe("with showPeriodUpper config enabled", function () {
|
||||
before(function () {
|
||||
// Set config sample for use in test
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/clock/clock_showPeriodUpper.js";
|
||||
});
|
||||
|
||||
it("shows 12hr time with upper case AM/PM", function() {
|
||||
it("shows 12hr time with upper case AM/PM", function () {
|
||||
const timeRegex = /^(?:1[0-2]|[1-9]):[0-5]\d[0-5]\d[AP]M$/;
|
||||
return app.client.waitUntilWindowLoaded().getText(".clock .time").should.eventually.match(timeRegex);
|
||||
});
|
||||
});
|
||||
|
||||
describe("with displaySeconds config disabled", function() {
|
||||
before(function() {
|
||||
describe("with displaySeconds config disabled", function () {
|
||||
before(function () {
|
||||
// Set config sample for use in test
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/clock/clock_displaySeconds_false.js";
|
||||
});
|
||||
|
||||
it("shows 12hr time without seconds am/pm", function() {
|
||||
it("shows 12hr time without seconds am/pm", function () {
|
||||
const timeRegex = /^(?:1[0-2]|[1-9]):[0-5]\d[ap]m$/;
|
||||
return app.client.waitUntilWindowLoaded().getText(".clock .time").should.eventually.match(timeRegex);
|
||||
});
|
||||
});
|
||||
|
||||
describe("with showWeek config enabled", function() {
|
||||
before(function() {
|
||||
describe("with showWeek config enabled", function () {
|
||||
before(function () {
|
||||
// Set config sample for use in test
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/clock/clock_showWeek.js";
|
||||
});
|
||||
|
||||
it("shows week with correct format", function() {
|
||||
it("shows week with correct format", function () {
|
||||
const weekRegex = /^Week [0-9]{1,2}$/;
|
||||
return app.client.waitUntilWindowLoaded().getText(".clock .week").should.eventually.match(weekRegex);
|
||||
});
|
||||
|
||||
it("shows week with correct number of week of year", function() {
|
||||
it("shows week with correct number of week of year", function () {
|
||||
it("FIXME: if the day is a sunday this not match");
|
||||
// const currentWeekNumber = require("current-week-number")();
|
||||
// const weekToShow = "Week " + currentWeekNumber;
|
||||
|
@@ -6,101 +6,119 @@ const it = global.it;
|
||||
const beforeEach = global.beforeEach;
|
||||
const afterEach = global.afterEach;
|
||||
|
||||
describe("Compliments module", function() {
|
||||
describe("Compliments module", function () {
|
||||
helpers.setupTimeout(this);
|
||||
|
||||
var app = null;
|
||||
|
||||
beforeEach(function() {
|
||||
beforeEach(function () {
|
||||
return helpers
|
||||
.startApplication({
|
||||
args: ["js/electron.js"]
|
||||
})
|
||||
.then(function(startedApp) {
|
||||
.then(function (startedApp) {
|
||||
app = startedApp;
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
afterEach(function () {
|
||||
return helpers.stopApplication(app);
|
||||
});
|
||||
|
||||
describe("parts of days", function() {
|
||||
before(function() {
|
||||
describe("parts of days", function () {
|
||||
before(function () {
|
||||
// Set config sample for use in test
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/compliments/compliments_parts_day.js";
|
||||
});
|
||||
|
||||
it("if Morning compliments for that part of day", function() {
|
||||
it("if Morning compliments for that part of day", function () {
|
||||
var hour = new Date().getHours();
|
||||
if (hour >= 3 && hour < 12) {
|
||||
// if morning check
|
||||
return app.client.waitUntilWindowLoaded().getText(".compliments").then(function(text) {
|
||||
expect(text).to.be.oneOf(["Hi", "Good Morning", "Morning test"]);
|
||||
});
|
||||
return app.client
|
||||
.waitUntilWindowLoaded()
|
||||
.getText(".compliments")
|
||||
.then(function (text) {
|
||||
expect(text).to.be.oneOf(["Hi", "Good Morning", "Morning test"]);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
it("if Afternoon show Compliments for that part of day", function() {
|
||||
it("if Afternoon show Compliments for that part of day", function () {
|
||||
var hour = new Date().getHours();
|
||||
if (hour >= 12 && hour < 17) {
|
||||
// if morning check
|
||||
return app.client.waitUntilWindowLoaded().getText(".compliments").then(function(text) {
|
||||
expect(text).to.be.oneOf(["Hello", "Good Afternoon", "Afternoon test"]);
|
||||
});
|
||||
return app.client
|
||||
.waitUntilWindowLoaded()
|
||||
.getText(".compliments")
|
||||
.then(function (text) {
|
||||
expect(text).to.be.oneOf(["Hello", "Good Afternoon", "Afternoon test"]);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
it("if Evening show Compliments for that part of day", function() {
|
||||
it("if Evening show Compliments for that part of day", function () {
|
||||
var hour = new Date().getHours();
|
||||
if (!(hour >= 3 && hour < 12) && !(hour >= 12 && hour < 17)) {
|
||||
// if evening check
|
||||
return app.client.waitUntilWindowLoaded().getText(".compliments").then(function(text) {
|
||||
expect(text).to.be.oneOf(["Hello There", "Good Evening", "Evening test"]);
|
||||
});
|
||||
return app.client
|
||||
.waitUntilWindowLoaded()
|
||||
.getText(".compliments")
|
||||
.then(function (text) {
|
||||
expect(text).to.be.oneOf(["Hello There", "Good Evening", "Evening test"]);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe("Feature anytime in compliments module", function() {
|
||||
describe("Set anytime and empty compliments for morning, evening and afternoon ", function() {
|
||||
before(function() {
|
||||
describe("Feature anytime in compliments module", function () {
|
||||
describe("Set anytime and empty compliments for morning, evening and afternoon ", function () {
|
||||
before(function () {
|
||||
// Set config sample for use in test
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/compliments/compliments_anytime.js";
|
||||
});
|
||||
|
||||
it("Show anytime because if configure empty parts of day compliments and set anytime compliments", function() {
|
||||
return app.client.waitUntilWindowLoaded().getText(".compliments").then(function(text) {
|
||||
expect(text).to.be.oneOf(["Anytime here"]);
|
||||
});
|
||||
it("Show anytime because if configure empty parts of day compliments and set anytime compliments", function () {
|
||||
return app.client
|
||||
.waitUntilWindowLoaded()
|
||||
.getText(".compliments")
|
||||
.then(function (text) {
|
||||
expect(text).to.be.oneOf(["Anytime here"]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("Only anytime present in configuration compliments", function() {
|
||||
before(function() {
|
||||
describe("Only anytime present in configuration compliments", function () {
|
||||
before(function () {
|
||||
// Set config sample for use in test
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/compliments/compliments_only_anytime.js";
|
||||
});
|
||||
|
||||
it("Show anytime compliments", function() {
|
||||
return app.client.waitUntilWindowLoaded().getText(".compliments").then(function(text) {
|
||||
expect(text).to.be.oneOf(["Anytime here"]);
|
||||
});
|
||||
it("Show anytime compliments", function () {
|
||||
return app.client
|
||||
.waitUntilWindowLoaded()
|
||||
.getText(".compliments")
|
||||
.then(function (text) {
|
||||
expect(text).to.be.oneOf(["Anytime here"]);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("Feature date in compliments module", function() {
|
||||
describe("Set date and empty compliments for anytime, morning, evening and afternoon", function() {
|
||||
before(function() {
|
||||
describe("Feature date in compliments module", function () {
|
||||
describe("Set date and empty compliments for anytime, morning, evening and afternoon", function () {
|
||||
before(function () {
|
||||
// Set config sample for use in test
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/compliments/compliments_date.js";
|
||||
});
|
||||
|
||||
it("Show happy new year compliment on new years day", function() {
|
||||
return app.client.waitUntilWindowLoaded().getText(".compliments").then(function(text) {
|
||||
expect(text).to.be.oneOf(["Happy new year!"]);
|
||||
});
|
||||
it("Show happy new year compliment on new years day", function () {
|
||||
return app.client
|
||||
.waitUntilWindowLoaded()
|
||||
.getText(".compliments")
|
||||
.then(function (text) {
|
||||
expect(text).to.be.oneOf(["Happy new year!"]);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@@ -5,46 +5,44 @@ const it = global.it;
|
||||
const beforeEach = global.beforeEach;
|
||||
const afterEach = global.afterEach;
|
||||
|
||||
describe("Test helloworld module", function() {
|
||||
describe("Test helloworld module", function () {
|
||||
helpers.setupTimeout(this);
|
||||
|
||||
var app = null;
|
||||
|
||||
beforeEach(function() {
|
||||
beforeEach(function () {
|
||||
return helpers
|
||||
.startApplication({
|
||||
args: ["js/electron.js"]
|
||||
})
|
||||
.then(function(startedApp) {
|
||||
.then(function (startedApp) {
|
||||
app = startedApp;
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
afterEach(function () {
|
||||
return helpers.stopApplication(app);
|
||||
});
|
||||
|
||||
describe("helloworld set config text", function () {
|
||||
before(function() {
|
||||
before(function () {
|
||||
// Set config sample for use in test
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/helloworld/helloworld.js";
|
||||
});
|
||||
|
||||
it("Test message helloworld module", function () {
|
||||
return app.client.waitUntilWindowLoaded()
|
||||
.getText(".helloworld").should.eventually.equal("Test HelloWorld Module");
|
||||
return app.client.waitUntilWindowLoaded().getText(".helloworld").should.eventually.equal("Test HelloWorld Module");
|
||||
});
|
||||
});
|
||||
|
||||
describe("helloworld default config text", function () {
|
||||
before(function() {
|
||||
before(function () {
|
||||
// Set config sample for use in test
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/helloworld/helloworld_default.js";
|
||||
});
|
||||
|
||||
it("Test message helloworld module", function () {
|
||||
return app.client.waitUntilWindowLoaded()
|
||||
.getText(".helloworld").should.eventually.equal("Hello World!");
|
||||
return app.client.waitUntilWindowLoaded().getText(".helloworld").should.eventually.equal("Hello World!");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@@ -1,4 +1,4 @@
|
||||
const generateWeather = require("./weather_current");
|
||||
const generateWeatherForecast = require("./weather_forecast");
|
||||
|
||||
module.exports = {generateWeather, generateWeatherForecast};
|
||||
module.exports = { generateWeather, generateWeatherForecast };
|
||||
|
@@ -1,54 +1,60 @@
|
||||
const _ = require("lodash");
|
||||
|
||||
function generateWeather(extendedData = {}) {
|
||||
return JSON.stringify(_.merge({}, {
|
||||
coord:{
|
||||
lon: 11.58,
|
||||
lat: 48.14
|
||||
},
|
||||
weather:[
|
||||
return JSON.stringify(
|
||||
_.merge(
|
||||
{},
|
||||
{
|
||||
id: 615,
|
||||
main: "Snow",
|
||||
description: "light rain and snow",
|
||||
icon: "13d"
|
||||
coord: {
|
||||
lon: 11.58,
|
||||
lat: 48.14
|
||||
},
|
||||
weather: [
|
||||
{
|
||||
id: 615,
|
||||
main: "Snow",
|
||||
description: "light rain and snow",
|
||||
icon: "13d"
|
||||
},
|
||||
{
|
||||
id: 500,
|
||||
main: "Rain",
|
||||
description: "light rain",
|
||||
icon: "10d"
|
||||
}
|
||||
],
|
||||
base: "stations",
|
||||
main: {
|
||||
temp: 1.49,
|
||||
pressure: 1005,
|
||||
humidity: 93.7,
|
||||
temp_min: 1,
|
||||
temp_max: 2
|
||||
},
|
||||
visibility: 7000,
|
||||
wind: {
|
||||
speed: 11.8,
|
||||
deg: 250
|
||||
},
|
||||
clouds: {
|
||||
all: 75
|
||||
},
|
||||
dt: 1547387400,
|
||||
sys: {
|
||||
type: 1,
|
||||
id: 1267,
|
||||
message: 0.0031,
|
||||
country: "DE",
|
||||
sunrise: 1547362817,
|
||||
sunset: 1547394301
|
||||
},
|
||||
id: 2867714,
|
||||
name: "Munich",
|
||||
cod: 200
|
||||
},
|
||||
{
|
||||
id: 500,
|
||||
main: "Rain",
|
||||
description: "light rain",
|
||||
icon: "10d"
|
||||
}
|
||||
],
|
||||
base: "stations",
|
||||
main:{
|
||||
temp: 1.49,
|
||||
pressure: 1005,
|
||||
humidity: 93.7,
|
||||
temp_min: 1,
|
||||
temp_max: 2
|
||||
},
|
||||
visibility: 7000,
|
||||
wind:{
|
||||
speed: 11.8,
|
||||
deg: 250
|
||||
},
|
||||
clouds:{
|
||||
all: 75
|
||||
},
|
||||
dt: 1547387400,
|
||||
sys:{
|
||||
type: 1,
|
||||
id: 1267,
|
||||
message: 0.0031,
|
||||
country: "DE",
|
||||
sunrise: 1547362817,
|
||||
sunset: 1547394301
|
||||
},
|
||||
id: 2867714,
|
||||
name: "Munich",
|
||||
cod: 200
|
||||
}, extendedData));
|
||||
extendedData
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
module.exports = generateWeather;
|
||||
|
@@ -1,97 +1,111 @@
|
||||
const _ = require("lodash");
|
||||
|
||||
function generateWeatherForecast(extendedData = {}) {
|
||||
return JSON.stringify(_.merge({}, {
|
||||
"city": {
|
||||
"id": 2867714,
|
||||
"name": "Munich",
|
||||
"coord": {"lon": 11.5754, "lat": 48.1371},
|
||||
"country": "DE",
|
||||
"population": 1260391,
|
||||
"timezone": 7200
|
||||
},
|
||||
"cod": "200",
|
||||
"message": 0.9653487,
|
||||
"cnt": 7,
|
||||
"list": [{
|
||||
"dt": 1568372400,
|
||||
"sunrise": 1568350044,
|
||||
"sunset": 1568395948,
|
||||
"temp": {"day": 24.44, "min": 15.35, "max": 24.44, "night": 15.35, "eve": 18, "morn": 23.03},
|
||||
"pressure": 1031.65,
|
||||
"humidity": 70,
|
||||
"weather": [{"id": 801, "main": "Clouds", "description": "few clouds", "icon": "02d"}],
|
||||
"speed": 3.35,
|
||||
"deg": 314,
|
||||
"clouds": 21
|
||||
}, {
|
||||
"dt": 1568458800,
|
||||
"sunrise": 1568436525,
|
||||
"sunset": 1568482223,
|
||||
"temp": {"day": 20.81, "min": 13.56, "max": 21.02, "night": 13.56, "eve": 16.6, "morn": 15.88},
|
||||
"pressure": 1028.81,
|
||||
"humidity": 72,
|
||||
"weather": [{"id": 500, "main": "Rain", "description": "light rain", "icon": "10d"}],
|
||||
"speed": 2.21,
|
||||
"deg": 81,
|
||||
"clouds": 100
|
||||
}, {
|
||||
"dt": 1568545200,
|
||||
"sunrise": 1568523007,
|
||||
"sunset": 1568568497,
|
||||
"temp": {"day": 22.65, "min": 13.76, "max": 22.88, "night": 15.27, "eve": 17.45, "morn": 13.76},
|
||||
"pressure": 1023.75,
|
||||
"humidity": 64,
|
||||
"weather": [{"id": 800, "main": "Clear", "description": "sky is clear", "icon": "01d"}],
|
||||
"speed": 1.15,
|
||||
"deg": 7,
|
||||
"clouds": 0
|
||||
}, {
|
||||
"dt": 1568631600,
|
||||
"sunrise": 1568609489,
|
||||
"sunset": 1568654771,
|
||||
"temp": {"day": 23.45, "min": 13.95, "max": 23.45, "night": 13.95, "eve": 17.75, "morn": 15.21},
|
||||
"pressure": 1020.41,
|
||||
"humidity": 64,
|
||||
"weather": [{"id": 800, "main": "Clear", "description": "sky is clear", "icon": "01d"}],
|
||||
"speed": 3.07,
|
||||
"deg": 298,
|
||||
"clouds": 7
|
||||
}, {
|
||||
"dt": 1568718000,
|
||||
"sunrise": 1568695970,
|
||||
"sunset": 1568741045,
|
||||
"temp": {"day": 20.55, "min": 10.95, "max": 20.55, "night": 10.95, "eve": 14.82, "morn": 13.24},
|
||||
"pressure": 1019.4,
|
||||
"humidity": 66,
|
||||
"weather": [{"id": 800, "main": "Clear", "description": "sky is clear", "icon": "01d"}],
|
||||
"speed": 2.8,
|
||||
"deg": 333,
|
||||
"clouds": 2
|
||||
}, {
|
||||
"dt": 1568804400,
|
||||
"sunrise": 1568782452,
|
||||
"sunset": 1568827319,
|
||||
"temp": {"day": 18.15, "min": 7.75, "max": 18.15, "night": 7.75, "eve": 12.45, "morn": 9.41},
|
||||
"pressure": 1017.56,
|
||||
"humidity": 52,
|
||||
"weather": [{"id": 800, "main": "Clear", "description": "sky is clear", "icon": "01d"}],
|
||||
"speed": 2.92,
|
||||
"deg": 34,
|
||||
"clouds": 0
|
||||
}, {
|
||||
"dt": 1568890800,
|
||||
"sunrise": 1568868934,
|
||||
"sunset": 1568913593,
|
||||
"temp": {"day": 14.85, "min": 5.56, "max": 15.05, "night": 5.56, "eve": 9.56, "morn": 6.25},
|
||||
"pressure": 1022.7,
|
||||
"humidity": 59,
|
||||
"weather": [{"id": 800, "main": "Clear", "description": "sky is clear", "icon": "01d"}],
|
||||
"speed": 2.89,
|
||||
"deg": 51,
|
||||
"clouds": 1
|
||||
}]
|
||||
}, extendedData));
|
||||
return JSON.stringify(
|
||||
_.merge(
|
||||
{},
|
||||
{
|
||||
city: {
|
||||
id: 2867714,
|
||||
name: "Munich",
|
||||
coord: { lon: 11.5754, lat: 48.1371 },
|
||||
country: "DE",
|
||||
population: 1260391,
|
||||
timezone: 7200
|
||||
},
|
||||
cod: "200",
|
||||
message: 0.9653487,
|
||||
cnt: 7,
|
||||
list: [
|
||||
{
|
||||
dt: 1568372400,
|
||||
sunrise: 1568350044,
|
||||
sunset: 1568395948,
|
||||
temp: { day: 24.44, min: 15.35, max: 24.44, night: 15.35, eve: 18, morn: 23.03 },
|
||||
pressure: 1031.65,
|
||||
humidity: 70,
|
||||
weather: [{ id: 801, main: "Clouds", description: "few clouds", icon: "02d" }],
|
||||
speed: 3.35,
|
||||
deg: 314,
|
||||
clouds: 21
|
||||
},
|
||||
{
|
||||
dt: 1568458800,
|
||||
sunrise: 1568436525,
|
||||
sunset: 1568482223,
|
||||
temp: { day: 20.81, min: 13.56, max: 21.02, night: 13.56, eve: 16.6, morn: 15.88 },
|
||||
pressure: 1028.81,
|
||||
humidity: 72,
|
||||
weather: [{ id: 500, main: "Rain", description: "light rain", icon: "10d" }],
|
||||
speed: 2.21,
|
||||
deg: 81,
|
||||
clouds: 100
|
||||
},
|
||||
{
|
||||
dt: 1568545200,
|
||||
sunrise: 1568523007,
|
||||
sunset: 1568568497,
|
||||
temp: { day: 22.65, min: 13.76, max: 22.88, night: 15.27, eve: 17.45, morn: 13.76 },
|
||||
pressure: 1023.75,
|
||||
humidity: 64,
|
||||
weather: [{ id: 800, main: "Clear", description: "sky is clear", icon: "01d" }],
|
||||
speed: 1.15,
|
||||
deg: 7,
|
||||
clouds: 0
|
||||
},
|
||||
{
|
||||
dt: 1568631600,
|
||||
sunrise: 1568609489,
|
||||
sunset: 1568654771,
|
||||
temp: { day: 23.45, min: 13.95, max: 23.45, night: 13.95, eve: 17.75, morn: 15.21 },
|
||||
pressure: 1020.41,
|
||||
humidity: 64,
|
||||
weather: [{ id: 800, main: "Clear", description: "sky is clear", icon: "01d" }],
|
||||
speed: 3.07,
|
||||
deg: 298,
|
||||
clouds: 7
|
||||
},
|
||||
{
|
||||
dt: 1568718000,
|
||||
sunrise: 1568695970,
|
||||
sunset: 1568741045,
|
||||
temp: { day: 20.55, min: 10.95, max: 20.55, night: 10.95, eve: 14.82, morn: 13.24 },
|
||||
pressure: 1019.4,
|
||||
humidity: 66,
|
||||
weather: [{ id: 800, main: "Clear", description: "sky is clear", icon: "01d" }],
|
||||
speed: 2.8,
|
||||
deg: 333,
|
||||
clouds: 2
|
||||
},
|
||||
{
|
||||
dt: 1568804400,
|
||||
sunrise: 1568782452,
|
||||
sunset: 1568827319,
|
||||
temp: { day: 18.15, min: 7.75, max: 18.15, night: 7.75, eve: 12.45, morn: 9.41 },
|
||||
pressure: 1017.56,
|
||||
humidity: 52,
|
||||
weather: [{ id: 800, main: "Clear", description: "sky is clear", icon: "01d" }],
|
||||
speed: 2.92,
|
||||
deg: 34,
|
||||
clouds: 0
|
||||
},
|
||||
{
|
||||
dt: 1568890800,
|
||||
sunrise: 1568868934,
|
||||
sunset: 1568913593,
|
||||
temp: { day: 14.85, min: 5.56, max: 15.05, night: 5.56, eve: 9.56, morn: 6.25 },
|
||||
pressure: 1022.7,
|
||||
humidity: 59,
|
||||
weather: [{ id: 800, main: "Clear", description: "sky is clear", icon: "01d" }],
|
||||
speed: 2.89,
|
||||
deg: 51,
|
||||
clouds: 1
|
||||
}
|
||||
]
|
||||
},
|
||||
extendedData
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
module.exports = generateWeatherForecast;
|
||||
|
@@ -5,31 +5,31 @@ const it = global.it;
|
||||
const beforeEach = global.beforeEach;
|
||||
const afterEach = global.afterEach;
|
||||
|
||||
describe("Newsfeed module", function() {
|
||||
describe("Newsfeed module", function () {
|
||||
helpers.setupTimeout(this);
|
||||
|
||||
var app = null;
|
||||
|
||||
beforeEach(function() {
|
||||
beforeEach(function () {
|
||||
return helpers
|
||||
.startApplication({
|
||||
args: ["js/electron.js"]
|
||||
})
|
||||
.then(function(startedApp) {
|
||||
.then(function (startedApp) {
|
||||
app = startedApp;
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
afterEach(function () {
|
||||
return helpers.stopApplication(app);
|
||||
});
|
||||
|
||||
describe("Default configuration", function() {
|
||||
before(function() {
|
||||
describe("Default configuration", function () {
|
||||
before(function () {
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/newsfeed/default.js";
|
||||
});
|
||||
|
||||
it("show title newsfeed", function() {
|
||||
it("show title newsfeed", function () {
|
||||
return app.client.waitUntilTextExists(".newsfeed .small", "Rodrigo Ramirez Blog", 10000).should.be.fulfilled;
|
||||
});
|
||||
});
|
||||
|
@@ -6,10 +6,9 @@ const wdajaxstub = require("webdriverajaxstub");
|
||||
|
||||
const helpers = require("../global-setup");
|
||||
|
||||
const {generateWeather, generateWeatherForecast} = require("./mocks");
|
||||
|
||||
describe("Weather module", function() {
|
||||
const { generateWeather, generateWeatherForecast } = require("./mocks");
|
||||
|
||||
describe("Weather module", function () {
|
||||
let app;
|
||||
|
||||
helpers.setupTimeout(this);
|
||||
@@ -24,85 +23,85 @@ describe("Weather module", function() {
|
||||
app.client.setupStub();
|
||||
}
|
||||
|
||||
afterEach(function() {
|
||||
afterEach(function () {
|
||||
return helpers.stopApplication(app);
|
||||
});
|
||||
|
||||
describe("Current weather", function() {
|
||||
describe("Current weather", function () {
|
||||
let template;
|
||||
|
||||
before(function() {
|
||||
before(function () {
|
||||
template = fs.readFileSync(path.join(__dirname, "..", "..", "..", "modules", "default", "weather", "current.njk"), "utf8");
|
||||
});
|
||||
|
||||
describe("Default configuration", function() {
|
||||
before(function() {
|
||||
describe("Default configuration", function () {
|
||||
before(function () {
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/weather/currentweather_default.js";
|
||||
});
|
||||
|
||||
it("should render wind speed and wind direction", async function() {
|
||||
it("should render wind speed and wind direction", async function () {
|
||||
const weather = generateWeather();
|
||||
await setup({template, data: weather});
|
||||
await setup({ template, data: weather });
|
||||
|
||||
return app.client.waitUntilTextExists(".weather .normal.medium span:nth-child(2)", "6 WSW", 10000);
|
||||
});
|
||||
|
||||
it("should render sunrise", async function() {
|
||||
it("should render sunrise", async function () {
|
||||
const sunrise = moment().startOf("day").unix();
|
||||
const sunset = moment().startOf("day").unix();
|
||||
|
||||
const weather = generateWeather({sys: {sunrise, sunset}});
|
||||
await setup({template, data: weather});
|
||||
const weather = generateWeather({ sys: { sunrise, sunset } });
|
||||
await setup({ template, data: weather });
|
||||
|
||||
await app.client.waitForExist(".weather .normal.medium span.wi.dimmed.wi-sunrise", 10000);
|
||||
|
||||
return app.client.waitUntilTextExists(".weather .normal.medium span:nth-child(4)", "12:00 am", 10000);
|
||||
});
|
||||
|
||||
it("should render sunset", async function() {
|
||||
it("should render sunset", async function () {
|
||||
const sunrise = moment().startOf("day").unix();
|
||||
const sunset = moment().endOf("day").unix();
|
||||
|
||||
const weather = generateWeather({sys: {sunrise, sunset}});
|
||||
await setup({template, data: weather});
|
||||
const weather = generateWeather({ sys: { sunrise, sunset } });
|
||||
await setup({ template, data: weather });
|
||||
|
||||
await app.client.waitForExist(".weather .normal.medium span.wi.dimmed.wi-sunset", 10000);
|
||||
|
||||
return app.client.waitUntilTextExists(".weather .normal.medium span:nth-child(4)", "11:59 pm", 10000);
|
||||
});
|
||||
|
||||
it("should render temperature with icon", async function() {
|
||||
it("should render temperature with icon", async function () {
|
||||
const weather = generateWeather();
|
||||
await setup({template, data: weather});
|
||||
await setup({ template, data: weather });
|
||||
|
||||
await app.client.waitForExist(".weather .large.light span.wi.weathericon.wi-snow", 10000);
|
||||
|
||||
return app.client.waitUntilTextExists(".weather .large.light span.bright", "1.5°", 10000);
|
||||
});
|
||||
|
||||
it("should render feels like temperature", async function() {
|
||||
it("should render feels like temperature", async function () {
|
||||
const weather = generateWeather();
|
||||
await setup({template, data: weather});
|
||||
await setup({ template, data: weather });
|
||||
|
||||
return app.client.waitUntilTextExists(".weather .normal.medium span.dimmed", "Feels like -5.6°", 10000);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Configuration Options", function() {
|
||||
before(function() {
|
||||
describe("Configuration Options", function () {
|
||||
before(function () {
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/weather/currentweather_options.js";
|
||||
});
|
||||
|
||||
it("should render useBeaufort = false", async function() {
|
||||
it("should render useBeaufort = false", async function () {
|
||||
const weather = generateWeather();
|
||||
await setup({template, data: weather});
|
||||
await setup({ template, data: weather });
|
||||
|
||||
return app.client.waitUntilTextExists(".weather .normal.medium span:nth-child(2)", "12", 10000);
|
||||
});
|
||||
|
||||
it("should render showWindDirectionAsArrow = true", async function() {
|
||||
it("should render showWindDirectionAsArrow = true", async function () {
|
||||
const weather = generateWeather();
|
||||
await setup({template, data: weather});
|
||||
await setup({ template, data: weather });
|
||||
|
||||
await app.client.waitForExist(".weather .normal.medium sup i.fa-long-arrow-up", 10000);
|
||||
const element = await app.client.getHTML(".weather .normal.medium sup i.fa-long-arrow-up");
|
||||
@@ -110,17 +109,17 @@ describe("Weather module", function() {
|
||||
expect(element).to.include("transform:rotate(250deg);");
|
||||
});
|
||||
|
||||
it("should render showHumidity = true", async function() {
|
||||
it("should render showHumidity = true", async function () {
|
||||
const weather = generateWeather();
|
||||
await setup({template, data: weather});
|
||||
await setup({ template, data: weather });
|
||||
|
||||
await app.client.waitUntilTextExists(".weather .normal.medium span:nth-child(3)", "93", 10000);
|
||||
return app.client.waitForExist(".weather .normal.medium sup i.wi-humidity", 10000);
|
||||
});
|
||||
|
||||
it("should render degreeLabel = true", async function() {
|
||||
it("should render degreeLabel = true", async function () {
|
||||
const weather = generateWeather();
|
||||
await setup({template, data: weather});
|
||||
await setup({ template, data: weather });
|
||||
|
||||
await app.client.waitUntilTextExists(".weather .large.light span.bright", "1°C", 10000);
|
||||
|
||||
@@ -128,41 +127,41 @@ describe("Weather module", function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe("Current weather units", function() {
|
||||
before(function() {
|
||||
describe("Current weather units", function () {
|
||||
before(function () {
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/weather/currentweather_units.js";
|
||||
});
|
||||
|
||||
it("should render imperial units", async function() {
|
||||
it("should render imperial units", async function () {
|
||||
const weather = generateWeather({
|
||||
main:{
|
||||
temp: 1.49 * 9 / 5 + 32,
|
||||
temp_min: 1 * 9 / 5 + 32,
|
||||
temp_max: 2 * 9 / 5 + 32
|
||||
main: {
|
||||
temp: (1.49 * 9) / 5 + 32,
|
||||
temp_min: (1 * 9) / 5 + 32,
|
||||
temp_max: (2 * 9) / 5 + 32
|
||||
},
|
||||
wind:{
|
||||
wind: {
|
||||
speed: 11.8 * 2.23694
|
||||
},
|
||||
}
|
||||
});
|
||||
await setup({template, data: weather});
|
||||
await setup({ template, data: weather });
|
||||
|
||||
await app.client.waitUntilTextExists(".weather .normal.medium span:nth-child(2)", "6 WSW", 10000);
|
||||
await app.client.waitUntilTextExists(".weather .large.light span.bright", "34,7°", 10000);
|
||||
return app.client.waitUntilTextExists(".weather .normal.medium span.dimmed", "22,0°", 10000);
|
||||
});
|
||||
|
||||
it("should render decimalSymbol = ','", async function() {
|
||||
it("should render decimalSymbol = ','", async function () {
|
||||
const weather = generateWeather({
|
||||
main:{
|
||||
temp: 1.49 * 9 / 5 + 32,
|
||||
temp_min: 1 * 9 / 5 + 32,
|
||||
temp_max: 2 * 9 / 5 + 32
|
||||
main: {
|
||||
temp: (1.49 * 9) / 5 + 32,
|
||||
temp_min: (1 * 9) / 5 + 32,
|
||||
temp_max: (2 * 9) / 5 + 32
|
||||
},
|
||||
wind:{
|
||||
wind: {
|
||||
speed: 11.8 * 2.23694
|
||||
},
|
||||
}
|
||||
});
|
||||
await setup({template, data: weather});
|
||||
await setup({ template, data: weather });
|
||||
|
||||
await app.client.waitUntilTextExists(".weather .normal.medium span:nth-child(3)", "93,7", 10000);
|
||||
await app.client.waitUntilTextExists(".weather .large.light span.bright", "34,7°", 10000);
|
||||
@@ -171,21 +170,21 @@ describe("Weather module", function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe("Weather Forecast", function() {
|
||||
describe("Weather Forecast", function () {
|
||||
let template;
|
||||
|
||||
before(function() {
|
||||
before(function () {
|
||||
template = fs.readFileSync(path.join(__dirname, "..", "..", "..", "modules", "default", "weather", "forecast.njk"), "utf8");
|
||||
});
|
||||
|
||||
describe("Default configuration", function() {
|
||||
before(function() {
|
||||
describe("Default configuration", function () {
|
||||
before(function () {
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/weather/forecastweather_default.js";
|
||||
});
|
||||
|
||||
it("should render days", async function() {
|
||||
it("should render days", async function () {
|
||||
const weather = generateWeatherForecast();
|
||||
await setup({template, data: weather});
|
||||
await setup({ template, data: weather });
|
||||
|
||||
const days = ["Fri", "Sat", "Sun", "Mon", "Tue"];
|
||||
|
||||
@@ -194,9 +193,9 @@ describe("Weather module", function() {
|
||||
}
|
||||
});
|
||||
|
||||
it("should render icons", async function() {
|
||||
it("should render icons", async function () {
|
||||
const weather = generateWeatherForecast();
|
||||
await setup({template, data: weather});
|
||||
await setup({ template, data: weather });
|
||||
|
||||
const icons = ["day-cloudy", "rain", "day-sunny", "day-sunny", "day-sunny"];
|
||||
|
||||
@@ -205,9 +204,9 @@ describe("Weather module", function() {
|
||||
}
|
||||
});
|
||||
|
||||
it("should render max temperatures", async function() {
|
||||
it("should render max temperatures", async function () {
|
||||
const weather = generateWeatherForecast();
|
||||
await setup({template, data: weather});
|
||||
await setup({ template, data: weather });
|
||||
|
||||
const temperatures = ["24.4°", "21.0°", "22.9°", "23.4°", "20.6°"];
|
||||
|
||||
@@ -216,9 +215,9 @@ describe("Weather module", function() {
|
||||
}
|
||||
});
|
||||
|
||||
it("should render min temperatures", async function() {
|
||||
it("should render min temperatures", async function () {
|
||||
const weather = generateWeatherForecast();
|
||||
await setup({template, data: weather});
|
||||
await setup({ template, data: weather });
|
||||
|
||||
const temperatures = ["15.3°", "13.6°", "13.8°", "13.9°", "10.9°"];
|
||||
|
||||
@@ -227,9 +226,9 @@ describe("Weather module", function() {
|
||||
}
|
||||
});
|
||||
|
||||
it("should render fading of rows", async function() {
|
||||
it("should render fading of rows", async function () {
|
||||
const weather = generateWeatherForecast();
|
||||
await setup({template, data: weather});
|
||||
await setup({ template, data: weather });
|
||||
|
||||
const opacities = [1, 1, 0.8, 0.5333333333333333, 0.2666666666666667];
|
||||
|
||||
@@ -242,21 +241,21 @@ describe("Weather module", function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe("Configuration Options", function() {
|
||||
before(function() {
|
||||
describe("Configuration Options", function () {
|
||||
before(function () {
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/weather/forecastweather_options.js";
|
||||
});
|
||||
|
||||
it("should render custom table class", async function() {
|
||||
it("should render custom table class", async function () {
|
||||
const weather = generateWeatherForecast();
|
||||
await setup({template, data: weather});
|
||||
await setup({ template, data: weather });
|
||||
|
||||
await app.client.waitForExist(".weather table.myTableClass", 10000);
|
||||
});
|
||||
|
||||
it("should render colored rows", async function() {
|
||||
it("should render colored rows", async function () {
|
||||
const weather = generateWeatherForecast();
|
||||
await setup({template, data: weather});
|
||||
await setup({ template, data: weather });
|
||||
|
||||
await app.client.waitForExist(".weather table.myTableClass", 10000);
|
||||
|
||||
|
@@ -9,7 +9,6 @@ describe("Position of modules", function () {
|
||||
var app = null;
|
||||
|
||||
describe("Using helloworld", function () {
|
||||
|
||||
after(function () {
|
||||
return helpers.stopApplication(app);
|
||||
});
|
||||
@@ -17,14 +16,16 @@ describe("Position of modules", function () {
|
||||
before(function () {
|
||||
// Set config sample for use in test
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/positions.js";
|
||||
return helpers.startApplication({
|
||||
args: ["js/electron.js"]
|
||||
}).then(function (startedApp) { app = startedApp; });
|
||||
return helpers
|
||||
.startApplication({
|
||||
args: ["js/electron.js"]
|
||||
})
|
||||
.then(function (startedApp) {
|
||||
app = startedApp;
|
||||
});
|
||||
});
|
||||
|
||||
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"];
|
||||
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"];
|
||||
|
||||
var position;
|
||||
var className;
|
||||
@@ -32,8 +33,10 @@ describe("Position of modules", function () {
|
||||
position = positions[idx];
|
||||
className = position.replace("_", ".");
|
||||
it("show text in " + position, function () {
|
||||
return app.client.waitUntilWindowLoaded()
|
||||
.getText("." + className).should.eventually.equal("Text in " + position);
|
||||
return app.client
|
||||
.waitUntilWindowLoaded()
|
||||
.getText("." + className)
|
||||
.should.eventually.equal("Text in " + position);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@@ -13,9 +13,13 @@ describe("port directive configuration", function () {
|
||||
var app = null;
|
||||
|
||||
beforeEach(function () {
|
||||
return helpers.startApplication({
|
||||
args: ["js/electron.js"]
|
||||
}).then(function (startedApp) { app = startedApp; });
|
||||
return helpers
|
||||
.startApplication({
|
||||
args: ["js/electron.js"]
|
||||
})
|
||||
.then(function (startedApp) {
|
||||
app = startedApp;
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(function () {
|
||||
|
@@ -5,13 +5,13 @@ const expect = chai.expect;
|
||||
const mlog = require("mocha-logger");
|
||||
const translations = require("../../translations/translations.js");
|
||||
const helmet = require("helmet");
|
||||
const {JSDOM} = require("jsdom");
|
||||
const { JSDOM } = require("jsdom");
|
||||
const express = require("express");
|
||||
|
||||
describe("Translations", function() {
|
||||
describe("Translations", function () {
|
||||
let server;
|
||||
|
||||
before(function() {
|
||||
before(function () {
|
||||
const app = express();
|
||||
app.use(helmet());
|
||||
app.use(function (req, res, next) {
|
||||
@@ -23,12 +23,12 @@ describe("Translations", function() {
|
||||
server = app.listen(3000);
|
||||
});
|
||||
|
||||
after(function() {
|
||||
after(function () {
|
||||
server.close();
|
||||
});
|
||||
|
||||
it("should have a translation file in the specified path", function() {
|
||||
for(let language in translations) {
|
||||
it("should have a translation file in the specified path", function () {
|
||||
for (let language in translations) {
|
||||
const file = fs.statSync(translations[language]);
|
||||
expect(file.isFile()).to.be.equal(true);
|
||||
}
|
||||
@@ -41,16 +41,18 @@ describe("Translations", function() {
|
||||
}
|
||||
};
|
||||
|
||||
describe("Parsing language files through the Translator class", function() {
|
||||
for(let language in translations) {
|
||||
it(`should parse ${language}`, function(done) {
|
||||
const dom = new JSDOM(`<script>var translations = ${JSON.stringify(translations)}; var Log = {log: function(){}};</script>\
|
||||
<script src="${path.join(__dirname, "..", "..", "js", "translator.js")}">`, { runScripts: "dangerously",
|
||||
resources: "usable" });
|
||||
dom.window.onload = function() {
|
||||
const {Translator} = dom.window;
|
||||
describe("Parsing language files through the Translator class", function () {
|
||||
for (let language in translations) {
|
||||
it(`should parse ${language}`, function (done) {
|
||||
const dom = new JSDOM(
|
||||
`<script>var translations = ${JSON.stringify(translations)}; var Log = {log: function(){}};</script>\
|
||||
<script src="${path.join(__dirname, "..", "..", "js", "translator.js")}">`,
|
||||
{ runScripts: "dangerously", resources: "usable" }
|
||||
);
|
||||
dom.window.onload = function () {
|
||||
const { Translator } = dom.window;
|
||||
|
||||
Translator.load(mmm, translations[language], false, function() {
|
||||
Translator.load(mmm, translations[language], false, function () {
|
||||
expect(Translator.translations[mmm.name]).to.be.an("object");
|
||||
expect(Object.keys(Translator.translations[mmm.name]).length).to.be.at.least(1);
|
||||
done();
|
||||
@@ -60,17 +62,19 @@ describe("Translations", function() {
|
||||
}
|
||||
});
|
||||
|
||||
describe("Same keys", function() {
|
||||
describe("Same keys", function () {
|
||||
let base;
|
||||
|
||||
before(function(done) {
|
||||
const dom = new JSDOM(`<script>var translations = ${JSON.stringify(translations)}; var Log = {log: function(){}};</script>\
|
||||
<script src="${path.join(__dirname, "..", "..", "js", "translator.js")}">`, { runScripts: "dangerously",
|
||||
resources: "usable" });
|
||||
dom.window.onload = function() {
|
||||
const {Translator} = dom.window;
|
||||
before(function (done) {
|
||||
const dom = new JSDOM(
|
||||
`<script>var translations = ${JSON.stringify(translations)}; var Log = {log: function(){}};</script>\
|
||||
<script src="${path.join(__dirname, "..", "..", "js", "translator.js")}">`,
|
||||
{ runScripts: "dangerously", resources: "usable" }
|
||||
);
|
||||
dom.window.onload = function () {
|
||||
const { Translator } = dom.window;
|
||||
|
||||
Translator.load(mmm, translations.en, false, function() {
|
||||
Translator.load(mmm, translations.en, false, function () {
|
||||
base = Object.keys(Translator.translations[mmm.name]).sort();
|
||||
done();
|
||||
});
|
||||
@@ -82,39 +86,41 @@ describe("Translations", function() {
|
||||
continue;
|
||||
}
|
||||
|
||||
describe(`Translation keys of ${language}`, function() {
|
||||
describe(`Translation keys of ${language}`, function () {
|
||||
let keys;
|
||||
|
||||
before(function(done){
|
||||
const dom = new JSDOM(`<script>var translations = ${JSON.stringify(translations)}; var Log = {log: function(){}};</script>\
|
||||
<script src="${path.join(__dirname, "..", "..", "js", "translator.js")}">`, { runScripts: "dangerously",
|
||||
resources: "usable" });
|
||||
dom.window.onload = function() {
|
||||
const {Translator} = dom.window;
|
||||
before(function (done) {
|
||||
const dom = new JSDOM(
|
||||
`<script>var translations = ${JSON.stringify(translations)}; var Log = {log: function(){}};</script>\
|
||||
<script src="${path.join(__dirname, "..", "..", "js", "translator.js")}">`,
|
||||
{ runScripts: "dangerously", resources: "usable" }
|
||||
);
|
||||
dom.window.onload = function () {
|
||||
const { Translator } = dom.window;
|
||||
|
||||
Translator.load(mmm, translations[language], false, function() {
|
||||
Translator.load(mmm, translations[language], false, function () {
|
||||
keys = Object.keys(Translator.translations[mmm.name]).sort();
|
||||
done();
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
it(`${language} keys should be in base`, function() {
|
||||
keys.forEach(function(key) {
|
||||
it(`${language} keys should be in base`, function () {
|
||||
keys.forEach(function (key) {
|
||||
expect(base.indexOf(key)).to.be.at.least(0);
|
||||
});
|
||||
});
|
||||
|
||||
it(`${language} should contain all base keys`, function() {
|
||||
it(`${language} should contain all base keys`, function () {
|
||||
// TODO: when all translations are fixed, use
|
||||
// expect(keys).to.deep.equal(base);
|
||||
// instead of the try-catch-block
|
||||
|
||||
try {
|
||||
expect(keys).to.deep.equal(base);
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
if (e instanceof chai.AssertionError) {
|
||||
const diff = base.filter(key => !keys.includes(key));
|
||||
const diff = base.filter((key) => !keys.includes(key));
|
||||
mlog.pending(`Missing Translations for language ${language}: ${diff}`);
|
||||
this.skip();
|
||||
} else {
|
||||
|
@@ -8,16 +8,19 @@ const before = global.before;
|
||||
const after = global.after;
|
||||
|
||||
describe("Vendors", function () {
|
||||
|
||||
helpers.setupTimeout(this);
|
||||
|
||||
var app = null;
|
||||
|
||||
before(function () {
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/env.js";
|
||||
return helpers.startApplication({
|
||||
args: ["js/electron.js"]
|
||||
}).then(function (startedApp) { app = startedApp; });
|
||||
return helpers
|
||||
.startApplication({
|
||||
args: ["js/electron.js"]
|
||||
})
|
||||
.then(function (startedApp) {
|
||||
app = startedApp;
|
||||
});
|
||||
});
|
||||
|
||||
after(function () {
|
||||
@@ -25,9 +28,8 @@ describe("Vendors", function () {
|
||||
});
|
||||
|
||||
describe("Get list vendors", function () {
|
||||
|
||||
var 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 () {
|
||||
var urlVendor = "http://localhost:8080/vendor/" + vendors[vendor];
|
||||
request.get(urlVendor, function (err, res, body) {
|
||||
@@ -36,8 +38,8 @@ describe("Vendors", function () {
|
||||
});
|
||||
});
|
||||
|
||||
Object.keys(vendors).forEach(vendor => {
|
||||
it(`should return 404 HTTP code for vendor https://localhost/"${vendor}"`, 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];
|
||||
request.get(urlVendor, function (err, res, body) {
|
||||
expect(res.statusCode).to.equal(404);
|
||||
|
@@ -11,9 +11,13 @@ describe("Check configuration without modules", function () {
|
||||
var app = null;
|
||||
|
||||
beforeEach(function () {
|
||||
return helpers.startApplication({
|
||||
args: ["js/electron.js"]
|
||||
}).then(function (startedApp) { app = startedApp; });
|
||||
return helpers
|
||||
.startApplication({
|
||||
args: ["js/electron.js"]
|
||||
})
|
||||
.then(function (startedApp) {
|
||||
app = startedApp;
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(function () {
|
||||
@@ -26,13 +30,10 @@ describe("Check configuration without modules", function () {
|
||||
});
|
||||
|
||||
it("Show the message MagicMirror title", function () {
|
||||
return app.client.waitUntilWindowLoaded()
|
||||
.getText("#module_1_helloworld .module-content").should.eventually.equal("Magic Mirror2");
|
||||
return app.client.waitUntilWindowLoaded().getText("#module_1_helloworld .module-content").should.eventually.equal("Magic Mirror2");
|
||||
});
|
||||
|
||||
it("Show the text Michael's website", function () {
|
||||
return app.client.waitUntilWindowLoaded()
|
||||
.getText("#module_5_helloworld .module-content").should.eventually.equal("www.michaelteeuw.nl");
|
||||
return app.client.waitUntilWindowLoaded().getText("#module_5_helloworld .module-content").should.eventually.equal("www.michaelteeuw.nl");
|
||||
});
|
||||
});
|
||||
|
||||
|
@@ -26,10 +26,10 @@ for (var i in directories) {
|
||||
app.use(directory, express.static(path.resolve(rootPath + directory)));
|
||||
}
|
||||
|
||||
exports.listen = function() {
|
||||
exports.listen = function () {
|
||||
server = app.listen.apply(app, arguments);
|
||||
};
|
||||
|
||||
exports.close = function(callback) {
|
||||
exports.close = function (callback) {
|
||||
server.close(callback);
|
||||
};
|
||||
|
@@ -1,38 +1,40 @@
|
||||
const expect = require("chai").expect;
|
||||
const path = require("path");
|
||||
const {JSDOM} = require("jsdom");
|
||||
const { JSDOM } = require("jsdom");
|
||||
|
||||
describe("File js/class", function() {
|
||||
describe("Test function cloneObject", function() {
|
||||
describe("File js/class", function () {
|
||||
describe("Test function cloneObject", function () {
|
||||
let clone;
|
||||
let dom;
|
||||
|
||||
before(function(done) {
|
||||
dom = new JSDOM(`<script>var Log = {log: function() {}};</script>\
|
||||
<script src="${path.join(__dirname, "..", "..", "..", "js", "class.js")}">`, { runScripts: "dangerously",
|
||||
resources: "usable" });
|
||||
dom.window.onload = function() {
|
||||
const {cloneObject} = dom.window;
|
||||
before(function (done) {
|
||||
dom = new JSDOM(
|
||||
`<script>var Log = {log: function() {}};</script>\
|
||||
<script src="${path.join(__dirname, "..", "..", "..", "js", "class.js")}">`,
|
||||
{ runScripts: "dangerously", resources: "usable" }
|
||||
);
|
||||
dom.window.onload = function () {
|
||||
const { cloneObject } = dom.window;
|
||||
clone = cloneObject;
|
||||
done();
|
||||
};
|
||||
});
|
||||
|
||||
it("should clone object", function() {
|
||||
const expected = {name: "Rodrigo", web: "https://rodrigoramirez.com", project: "MagicMirror"};
|
||||
it("should clone object", function () {
|
||||
const expected = { name: "Rodrigo", web: "https://rodrigoramirez.com", project: "MagicMirror" };
|
||||
const obj = clone(expected);
|
||||
expect(obj).to.deep.equal(expected);
|
||||
expect(expected === obj).to.equal(false);
|
||||
});
|
||||
|
||||
it("should clone array", function() {
|
||||
it("should clone array", function () {
|
||||
const expected = [1, null, undefined, "TEST"];
|
||||
const obj = clone(expected);
|
||||
expect(obj).to.deep.equal(expected);
|
||||
expect(expected === obj).to.equal(false);
|
||||
});
|
||||
|
||||
it("should clone number", function() {
|
||||
it("should clone number", function () {
|
||||
let expected = 1;
|
||||
let obj = clone(expected);
|
||||
expect(obj).to.equal(expected);
|
||||
@@ -42,32 +44,32 @@ describe("File js/class", function() {
|
||||
expect(obj).to.equal(expected);
|
||||
});
|
||||
|
||||
it("should clone string", function() {
|
||||
it("should clone string", function () {
|
||||
const expected = "Perfect stranger";
|
||||
const obj = clone(expected);
|
||||
expect(obj).to.equal(expected);
|
||||
});
|
||||
|
||||
it("should clone undefined", function() {
|
||||
it("should clone undefined", function () {
|
||||
const expected = undefined;
|
||||
const obj = clone(expected);
|
||||
expect(obj).to.equal(expected);
|
||||
});
|
||||
|
||||
it("should clone null", function() {
|
||||
it("should clone null", function () {
|
||||
const expected = null;
|
||||
const obj = clone(expected);
|
||||
expect(obj).to.equal(expected);
|
||||
});
|
||||
|
||||
it("should clone nested object", function() {
|
||||
it("should clone nested object", function () {
|
||||
const expected = {
|
||||
name: "fewieden",
|
||||
link: "https://github.com/fewieden",
|
||||
versions: ["2.0", "2.1", "2.2"],
|
||||
answerForAllQuestions: 42,
|
||||
properties: {
|
||||
items: [{foo: "bar"}, {lorem: "ipsum"}],
|
||||
items: [{ foo: "bar" }, { lorem: "ipsum" }],
|
||||
invalid: undefined,
|
||||
nothing: null
|
||||
}
|
||||
@@ -82,22 +84,22 @@ describe("File js/class", function() {
|
||||
expect(expected.properties.items[1] === obj.properties.items[1]).to.equal(false);
|
||||
});
|
||||
|
||||
describe("Test lockstring code", function() {
|
||||
describe("Test lockstring code", function () {
|
||||
let log;
|
||||
|
||||
before(function() {
|
||||
before(function () {
|
||||
log = dom.window.Log.log;
|
||||
dom.window.Log.log = function cmp(str) {
|
||||
expect(str).to.equal("lockStrings");
|
||||
};
|
||||
});
|
||||
|
||||
after(function() {
|
||||
after(function () {
|
||||
dom.window.Log.log = log;
|
||||
});
|
||||
|
||||
it("should clone object and log lockStrings", function() {
|
||||
const expected = {name: "Module", lockStrings: "stringLock"};
|
||||
it("should clone object and log lockStrings", function () {
|
||||
const expected = { name: "Module", lockStrings: "stringLock" };
|
||||
const obj = clone(expected);
|
||||
expect(obj).to.deep.equal(expected);
|
||||
expect(expected === obj).to.equal(false);
|
||||
@@ -105,4 +107,3 @@ describe("File js/class", function() {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
@@ -1,12 +1,12 @@
|
||||
const expect = require("chai").expect;
|
||||
const deprecated = require("../../../js/deprecated");
|
||||
|
||||
describe("Deprecated", function() {
|
||||
it("should be an object", function() {
|
||||
describe("Deprecated", function () {
|
||||
it("should be an object", function () {
|
||||
expect(deprecated).to.be.an("object");
|
||||
});
|
||||
|
||||
it("should contain configs array with deprecated options as strings", function() {
|
||||
it("should contain configs array with deprecated options as strings", function () {
|
||||
expect(deprecated.configs).to.be.an("array");
|
||||
for (let option of deprecated.configs) {
|
||||
expect(option).to.be.an("string");
|
||||
|
@@ -1,13 +1,13 @@
|
||||
const expect = require("chai").expect;
|
||||
const path = require("path");
|
||||
const helmet = require("helmet");
|
||||
const {JSDOM} = require("jsdom");
|
||||
const { JSDOM } = require("jsdom");
|
||||
const express = require("express");
|
||||
|
||||
describe("Translator", function() {
|
||||
describe("Translator", function () {
|
||||
let server;
|
||||
|
||||
before(function() {
|
||||
before(function () {
|
||||
const app = express();
|
||||
app.use(helmet());
|
||||
app.use(function (req, res, next) {
|
||||
@@ -19,42 +19,42 @@ describe("Translator", function() {
|
||||
server = app.listen(3000);
|
||||
});
|
||||
|
||||
after(function() {
|
||||
after(function () {
|
||||
server.close();
|
||||
});
|
||||
|
||||
describe("translate", function() {
|
||||
describe("translate", function () {
|
||||
const translations = {
|
||||
"MMM-Module": {
|
||||
"Hello": "Hallo",
|
||||
Hello: "Hallo",
|
||||
"Hello {username}": "Hallo {username}"
|
||||
}
|
||||
};
|
||||
|
||||
const coreTranslations = {
|
||||
"Hello": "XXX",
|
||||
Hello: "XXX",
|
||||
"Hello {username}": "XXX",
|
||||
"FOO": "Foo",
|
||||
FOO: "Foo",
|
||||
"BAR {something}": "Bar {something}"
|
||||
};
|
||||
|
||||
const translationsFallback = {
|
||||
"MMM-Module": {
|
||||
"Hello": "XXX",
|
||||
Hello: "XXX",
|
||||
"Hello {username}": "XXX",
|
||||
"FOO": "XXX",
|
||||
FOO: "XXX",
|
||||
"BAR {something}": "XXX",
|
||||
"A key": "A translation"
|
||||
}
|
||||
};
|
||||
|
||||
const coreTranslationsFallback = {
|
||||
"FOO": "XXX",
|
||||
FOO: "XXX",
|
||||
"BAR {something}": "XXX",
|
||||
"Hello": "XXX",
|
||||
Hello: "XXX",
|
||||
"Hello {username}": "XXX",
|
||||
"A key": "XXX",
|
||||
"Fallback": "core fallback"
|
||||
Fallback: "core fallback"
|
||||
};
|
||||
|
||||
function setTranslations(Translator) {
|
||||
@@ -64,84 +64,78 @@ describe("Translator", function() {
|
||||
Translator.coreTranslationsFallback = coreTranslationsFallback;
|
||||
}
|
||||
|
||||
it("should return custom module translation", function(done) {
|
||||
const dom = new JSDOM(`<script src="${path.join(__dirname, "..", "..", "..", "js", "translator.js")}">`, { runScripts: "dangerously",
|
||||
resources: "usable" });
|
||||
dom.window.onload = function() {
|
||||
const {Translator} = dom.window;
|
||||
it("should return custom module translation", function (done) {
|
||||
const dom = new JSDOM(`<script src="${path.join(__dirname, "..", "..", "..", "js", "translator.js")}">`, { runScripts: "dangerously", resources: "usable" });
|
||||
dom.window.onload = function () {
|
||||
const { Translator } = dom.window;
|
||||
setTranslations(Translator);
|
||||
let translation = Translator.translate({name: "MMM-Module"}, "Hello");
|
||||
let translation = Translator.translate({ name: "MMM-Module" }, "Hello");
|
||||
expect(translation).to.be.equal("Hallo");
|
||||
translation = Translator.translate({name: "MMM-Module"}, "Hello {username}", {username: "fewieden"});
|
||||
translation = Translator.translate({ name: "MMM-Module" }, "Hello {username}", { username: "fewieden" });
|
||||
expect(translation).to.be.equal("Hallo fewieden");
|
||||
done();
|
||||
};
|
||||
});
|
||||
|
||||
it("should return core translation", function(done) {
|
||||
const dom = new JSDOM(`<script src="${path.join(__dirname, "..", "..", "..", "js", "translator.js")}">`, { runScripts: "dangerously",
|
||||
resources: "usable" });
|
||||
dom.window.onload = function() {
|
||||
const {Translator} = dom.window;
|
||||
it("should return core translation", function (done) {
|
||||
const dom = new JSDOM(`<script src="${path.join(__dirname, "..", "..", "..", "js", "translator.js")}">`, { runScripts: "dangerously", resources: "usable" });
|
||||
dom.window.onload = function () {
|
||||
const { Translator } = dom.window;
|
||||
setTranslations(Translator);
|
||||
let translation = Translator.translate({name: "MMM-Module"}, "FOO");
|
||||
let translation = Translator.translate({ name: "MMM-Module" }, "FOO");
|
||||
expect(translation).to.be.equal("Foo");
|
||||
translation = Translator.translate({name: "MMM-Module"}, "BAR {something}", {something: "Lorem Ipsum"});
|
||||
translation = Translator.translate({ name: "MMM-Module" }, "BAR {something}", { something: "Lorem Ipsum" });
|
||||
expect(translation).to.be.equal("Bar Lorem Ipsum");
|
||||
done();
|
||||
};
|
||||
});
|
||||
|
||||
it("should return custom module translation fallback", function(done) {
|
||||
const dom = new JSDOM(`<script src="${path.join(__dirname, "..", "..", "..", "js", "translator.js")}">`, { runScripts: "dangerously",
|
||||
resources: "usable" });
|
||||
dom.window.onload = function() {
|
||||
const {Translator} = dom.window;
|
||||
it("should return custom module translation fallback", function (done) {
|
||||
const dom = new JSDOM(`<script src="${path.join(__dirname, "..", "..", "..", "js", "translator.js")}">`, { runScripts: "dangerously", resources: "usable" });
|
||||
dom.window.onload = function () {
|
||||
const { Translator } = dom.window;
|
||||
setTranslations(Translator);
|
||||
const translation = Translator.translate({name: "MMM-Module"}, "A key");
|
||||
const translation = Translator.translate({ name: "MMM-Module" }, "A key");
|
||||
expect(translation).to.be.equal("A translation");
|
||||
done();
|
||||
};
|
||||
});
|
||||
|
||||
it("should return core translation fallback", function(done) {
|
||||
const dom = new JSDOM(`<script src="${path.join(__dirname, "..", "..", "..", "js", "translator.js")}">`, { runScripts: "dangerously",
|
||||
resources: "usable" });
|
||||
dom.window.onload = function() {
|
||||
const {Translator} = dom.window;
|
||||
it("should return core translation fallback", function (done) {
|
||||
const dom = new JSDOM(`<script src="${path.join(__dirname, "..", "..", "..", "js", "translator.js")}">`, { runScripts: "dangerously", resources: "usable" });
|
||||
dom.window.onload = function () {
|
||||
const { Translator } = dom.window;
|
||||
setTranslations(Translator);
|
||||
const translation = Translator.translate({name: "MMM-Module"}, "Fallback");
|
||||
const translation = Translator.translate({ name: "MMM-Module" }, "Fallback");
|
||||
expect(translation).to.be.equal("core fallback");
|
||||
done();
|
||||
};
|
||||
});
|
||||
|
||||
it("should return translation with placeholder for missing variables", function(done) {
|
||||
const dom = new JSDOM(`<script src="${path.join(__dirname, "..", "..", "..", "js", "translator.js")}">`, { runScripts: "dangerously",
|
||||
resources: "usable" });
|
||||
dom.window.onload = function() {
|
||||
const {Translator} = dom.window;
|
||||
it("should return translation with placeholder for missing variables", function (done) {
|
||||
const dom = new JSDOM(`<script src="${path.join(__dirname, "..", "..", "..", "js", "translator.js")}">`, { runScripts: "dangerously", resources: "usable" });
|
||||
dom.window.onload = function () {
|
||||
const { Translator } = dom.window;
|
||||
setTranslations(Translator);
|
||||
const translation = Translator.translate({name: "MMM-Module"}, "Hello {username}");
|
||||
const translation = Translator.translate({ name: "MMM-Module" }, "Hello {username}");
|
||||
expect(translation).to.be.equal("Hallo {username}");
|
||||
done();
|
||||
};
|
||||
});
|
||||
|
||||
it("should return key if no translation was found", function(done) {
|
||||
const dom = new JSDOM(`<script src="${path.join(__dirname, "..", "..", "..", "js", "translator.js")}">`, { runScripts: "dangerously",
|
||||
resources: "usable" });
|
||||
dom.window.onload = function() {
|
||||
const {Translator} = dom.window;
|
||||
it("should return key if no translation was found", function (done) {
|
||||
const dom = new JSDOM(`<script src="${path.join(__dirname, "..", "..", "..", "js", "translator.js")}">`, { runScripts: "dangerously", resources: "usable" });
|
||||
dom.window.onload = function () {
|
||||
const { Translator } = dom.window;
|
||||
setTranslations(Translator);
|
||||
const translation = Translator.translate({name: "MMM-Module"}, "MISSING");
|
||||
const translation = Translator.translate({ name: "MMM-Module" }, "MISSING");
|
||||
expect(translation).to.be.equal("MISSING");
|
||||
done();
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
describe("load", function() {
|
||||
describe("load", function () {
|
||||
const mmm = {
|
||||
name: "TranslationTest",
|
||||
file(file) {
|
||||
@@ -149,14 +143,13 @@ describe("Translator", function() {
|
||||
}
|
||||
};
|
||||
|
||||
it("should load translations", function(done) {
|
||||
const dom = new JSDOM(`<script>var Log = {log: function(){}};</script><script src="${path.join(__dirname, "..", "..", "..", "js", "translator.js")}">`, { runScripts: "dangerously",
|
||||
resources: "usable" });
|
||||
dom.window.onload = function() {
|
||||
const {Translator} = dom.window;
|
||||
it("should load translations", function (done) {
|
||||
const dom = new JSDOM(`<script>var Log = {log: function(){}};</script><script src="${path.join(__dirname, "..", "..", "..", "js", "translator.js")}">`, { runScripts: "dangerously", resources: "usable" });
|
||||
dom.window.onload = function () {
|
||||
const { Translator } = dom.window;
|
||||
const file = "TranslationTest.json";
|
||||
|
||||
Translator.load(mmm, file, false, function() {
|
||||
Translator.load(mmm, file, false, function () {
|
||||
const json = require(path.join(__dirname, "..", "..", "..", "tests", "configs", "data", file));
|
||||
expect(Translator.translations[mmm.name]).to.be.deep.equal(json);
|
||||
done();
|
||||
@@ -164,14 +157,13 @@ describe("Translator", function() {
|
||||
};
|
||||
});
|
||||
|
||||
it("should load translation fallbacks", function(done) {
|
||||
const dom = new JSDOM(`<script>var Log = {log: function(){}};</script><script src="${path.join(__dirname, "..", "..", "..", "js", "translator.js")}">`, { runScripts: "dangerously",
|
||||
resources: "usable" });
|
||||
dom.window.onload = function() {
|
||||
const {Translator} = dom.window;
|
||||
it("should load translation fallbacks", function (done) {
|
||||
const dom = new JSDOM(`<script>var Log = {log: function(){}};</script><script src="${path.join(__dirname, "..", "..", "..", "js", "translator.js")}">`, { runScripts: "dangerously", resources: "usable" });
|
||||
dom.window.onload = function () {
|
||||
const { Translator } = dom.window;
|
||||
const file = "TranslationTest.json";
|
||||
|
||||
Translator.load(mmm, file, true, function() {
|
||||
Translator.load(mmm, file, true, function () {
|
||||
const json = require(path.join(__dirname, "..", "..", "..", "tests", "configs", "data", file));
|
||||
expect(Translator.translationsFallback[mmm.name]).to.be.deep.equal(json);
|
||||
done();
|
||||
@@ -179,34 +171,32 @@ describe("Translator", function() {
|
||||
};
|
||||
});
|
||||
|
||||
it("should strip comments", function(done) {
|
||||
const dom = new JSDOM(`<script>var Log = {log: function(){}};</script><script src="${path.join(__dirname, "..", "..", "..", "js", "translator.js")}">`, { runScripts: "dangerously",
|
||||
resources: "usable" });
|
||||
dom.window.onload = function() {
|
||||
const {Translator} = dom.window;
|
||||
it("should strip comments", function (done) {
|
||||
const dom = new JSDOM(`<script>var Log = {log: function(){}};</script><script src="${path.join(__dirname, "..", "..", "..", "js", "translator.js")}">`, { runScripts: "dangerously", resources: "usable" });
|
||||
dom.window.onload = function () {
|
||||
const { Translator } = dom.window;
|
||||
const file = "StripComments.json";
|
||||
|
||||
Translator.load(mmm, file, false, function() {
|
||||
Translator.load(mmm, file, false, function () {
|
||||
expect(Translator.translations[mmm.name]).to.be.deep.equal({
|
||||
"FOO\"BAR": "Today",
|
||||
"N": "N",
|
||||
"E": "E",
|
||||
"S": "S",
|
||||
"W": "W"
|
||||
'FOO"BAR': "Today",
|
||||
N: "N",
|
||||
E: "E",
|
||||
S: "S",
|
||||
W: "W"
|
||||
});
|
||||
done();
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
it("should not load translations, if module fallback exists", function(done) {
|
||||
const dom = new JSDOM(`<script>var Log = {log: function(){}};</script><script src="${path.join(__dirname, "..", "..", "..", "js", "translator.js")}">`, { runScripts: "dangerously",
|
||||
resources: "usable" });
|
||||
dom.window.onload = function() {
|
||||
const {Translator, XMLHttpRequest} = dom.window;
|
||||
it("should not load translations, if module fallback exists", function (done) {
|
||||
const dom = new JSDOM(`<script>var Log = {log: function(){}};</script><script src="${path.join(__dirname, "..", "..", "..", "js", "translator.js")}">`, { runScripts: "dangerously", resources: "usable" });
|
||||
dom.window.onload = function () {
|
||||
const { Translator, XMLHttpRequest } = dom.window;
|
||||
const file = "TranslationTest.json";
|
||||
|
||||
XMLHttpRequest.prototype.send = function() {
|
||||
XMLHttpRequest.prototype.send = function () {
|
||||
throw "Shouldn't load files";
|
||||
};
|
||||
|
||||
@@ -214,7 +204,7 @@ describe("Translator", function() {
|
||||
Hello: "Hallo"
|
||||
};
|
||||
|
||||
Translator.load(mmm, file, false, function() {
|
||||
Translator.load(mmm, file, false, function () {
|
||||
expect(Translator.translations[mmm.name]).to.be.undefined;
|
||||
expect(Translator.translationsFallback[mmm.name]).to.be.deep.equal({
|
||||
Hello: "Hallo"
|
||||
@@ -225,17 +215,19 @@ describe("Translator", function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe("loadCoreTranslations", function() {
|
||||
it("should load core translations and fallback", function(done) {
|
||||
const dom = new JSDOM(`<script>var translations = {en: "http://localhost:3000/translations/en.json"}; var Log = {log: function(){}};</script>\
|
||||
<script src="${path.join(__dirname, "..", "..", "..", "js", "translator.js")}">`, { runScripts: "dangerously",
|
||||
resources: "usable" });
|
||||
dom.window.onload = function() {
|
||||
const {Translator} = dom.window;
|
||||
describe("loadCoreTranslations", function () {
|
||||
it("should load core translations and fallback", function (done) {
|
||||
const dom = new JSDOM(
|
||||
`<script>var translations = {en: "http://localhost:3000/translations/en.json"}; var Log = {log: function(){}};</script>\
|
||||
<script src="${path.join(__dirname, "..", "..", "..", "js", "translator.js")}">`,
|
||||
{ runScripts: "dangerously", resources: "usable" }
|
||||
);
|
||||
dom.window.onload = function () {
|
||||
const { Translator } = dom.window;
|
||||
Translator.loadCoreTranslations("en");
|
||||
|
||||
const en = require(path.join(__dirname, "..", "..", "..", "tests", "configs", "data", "en.json"));
|
||||
setTimeout(function() {
|
||||
setTimeout(function () {
|
||||
expect(Translator.coreTranslations).to.be.deep.equal(en);
|
||||
expect(Translator.coreTranslationsFallback).to.be.deep.equal(en);
|
||||
done();
|
||||
@@ -243,16 +235,18 @@ describe("Translator", function() {
|
||||
};
|
||||
});
|
||||
|
||||
it("should load core fallback if language cannot be found", function(done) {
|
||||
const dom = new JSDOM(`<script>var translations = {en: "http://localhost:3000/translations/en.json"}; var Log = {log: function(){}};</script>\
|
||||
<script src="${path.join(__dirname, "..", "..", "..", "js", "translator.js")}">`, { runScripts: "dangerously",
|
||||
resources: "usable" });
|
||||
dom.window.onload = function() {
|
||||
const {Translator} = dom.window;
|
||||
it("should load core fallback if language cannot be found", function (done) {
|
||||
const dom = new JSDOM(
|
||||
`<script>var translations = {en: "http://localhost:3000/translations/en.json"}; var Log = {log: function(){}};</script>\
|
||||
<script src="${path.join(__dirname, "..", "..", "..", "js", "translator.js")}">`,
|
||||
{ runScripts: "dangerously", resources: "usable" }
|
||||
);
|
||||
dom.window.onload = function () {
|
||||
const { Translator } = dom.window;
|
||||
Translator.loadCoreTranslations("MISSINGLANG");
|
||||
|
||||
const en = require(path.join(__dirname, "..", "..", "..", "tests", "configs", "data", "en.json"));
|
||||
setTimeout(function() {
|
||||
setTimeout(function () {
|
||||
expect(Translator.coreTranslations).to.be.deep.equal({});
|
||||
expect(Translator.coreTranslationsFallback).to.be.deep.equal(en);
|
||||
done();
|
||||
@@ -261,32 +255,36 @@ describe("Translator", function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe("loadCoreTranslationsFallback", function() {
|
||||
it("should load core translations fallback", function(done) {
|
||||
const dom = new JSDOM(`<script>var translations = {en: "http://localhost:3000/translations/en.json"}; var Log = {log: function(){}};</script>\
|
||||
<script src="${path.join(__dirname, "..", "..", "..", "js", "translator.js")}">`, { runScripts: "dangerously",
|
||||
resources: "usable" });
|
||||
dom.window.onload = function() {
|
||||
const {Translator} = dom.window;
|
||||
describe("loadCoreTranslationsFallback", function () {
|
||||
it("should load core translations fallback", function (done) {
|
||||
const dom = new JSDOM(
|
||||
`<script>var translations = {en: "http://localhost:3000/translations/en.json"}; var Log = {log: function(){}};</script>\
|
||||
<script src="${path.join(__dirname, "..", "..", "..", "js", "translator.js")}">`,
|
||||
{ runScripts: "dangerously", resources: "usable" }
|
||||
);
|
||||
dom.window.onload = function () {
|
||||
const { Translator } = dom.window;
|
||||
Translator.loadCoreTranslationsFallback();
|
||||
|
||||
const en = require(path.join(__dirname, "..", "..", "..", "tests", "configs", "data", "en.json"));
|
||||
setTimeout(function() {
|
||||
setTimeout(function () {
|
||||
expect(Translator.coreTranslationsFallback).to.be.deep.equal(en);
|
||||
done();
|
||||
}, 500);
|
||||
};
|
||||
});
|
||||
|
||||
it("should load core fallback if language cannot be found", function(done) {
|
||||
const dom = new JSDOM(`<script>var translations = {}; var Log = {log: function(){}};</script>\
|
||||
<script src="${path.join(__dirname, "..", "..", "..", "js", "translator.js")}">`, { runScripts: "dangerously",
|
||||
resources: "usable" });
|
||||
dom.window.onload = function() {
|
||||
const {Translator} = dom.window;
|
||||
it("should load core fallback if language cannot be found", function (done) {
|
||||
const dom = new JSDOM(
|
||||
`<script>var translations = {}; var Log = {log: function(){}};</script>\
|
||||
<script src="${path.join(__dirname, "..", "..", "..", "js", "translator.js")}">`,
|
||||
{ runScripts: "dangerously", resources: "usable" }
|
||||
);
|
||||
dom.window.onload = function () {
|
||||
const { Translator } = dom.window;
|
||||
Translator.loadCoreTranslations();
|
||||
|
||||
setTimeout(function() {
|
||||
setTimeout(function () {
|
||||
expect(Translator.coreTranslationsFallback).to.be.deep.equal({});
|
||||
done();
|
||||
}, 500);
|
||||
|
@@ -2,34 +2,34 @@ var expect = require("chai").expect;
|
||||
var Utils = require("../../../js/utils.js");
|
||||
var colors = require("colors/safe");
|
||||
|
||||
describe("Utils", function() {
|
||||
describe("colors", function() {
|
||||
describe("Utils", function () {
|
||||
describe("colors", function () {
|
||||
var colorsEnabled = colors.enabled;
|
||||
|
||||
afterEach(function() {
|
||||
afterEach(function () {
|
||||
colors.enabled = colorsEnabled;
|
||||
});
|
||||
|
||||
it("should have info, warn and error properties", function() {
|
||||
it("should have info, warn and error properties", function () {
|
||||
expect(Utils.colors).to.have.property("info");
|
||||
expect(Utils.colors).to.have.property("warn");
|
||||
expect(Utils.colors).to.have.property("error");
|
||||
});
|
||||
|
||||
it("properties should be functions", function() {
|
||||
it("properties should be functions", function () {
|
||||
expect(Utils.colors.info).to.be.a("function");
|
||||
expect(Utils.colors.warn).to.be.a("function");
|
||||
expect(Utils.colors.error).to.be.a("function");
|
||||
});
|
||||
|
||||
it("should print colored message in supported consoles", function() {
|
||||
it("should print colored message in supported consoles", function () {
|
||||
colors.enabled = true;
|
||||
expect(Utils.colors.info("some informations")).to.be.equal("\u001b[34msome informations\u001b[39m");
|
||||
expect(Utils.colors.warn("a warning")).to.be.equal("\u001b[33ma warning\u001b[39m");
|
||||
expect(Utils.colors.error("ERROR!")).to.be.equal("\u001b[31mERROR!\u001b[39m");
|
||||
});
|
||||
|
||||
it("should print message in unsupported consoles", function() {
|
||||
it("should print message in unsupported consoles", function () {
|
||||
colors.enabled = false;
|
||||
expect(Utils.colors.info("some informations")).to.be.equal("some informations");
|
||||
expect(Utils.colors.warn("a warning")).to.be.equal("a warning");
|
||||
|
@@ -2,8 +2,7 @@ const expect = require("chai").expect;
|
||||
|
||||
global.moment = require("moment");
|
||||
|
||||
describe("Functions into modules/default/calendar/calendar.js", function() {
|
||||
|
||||
describe("Functions into modules/default/calendar/calendar.js", function () {
|
||||
// Fake for use by calendar.js
|
||||
Module = {};
|
||||
Module.definitions = {};
|
||||
@@ -11,93 +10,93 @@ describe("Functions into modules/default/calendar/calendar.js", function() {
|
||||
Module.definitions[name] = moduleDefinition;
|
||||
};
|
||||
|
||||
before(function() {
|
||||
before(function () {
|
||||
// load calendar.js
|
||||
require("../../../modules/default/calendar/calendar.js");
|
||||
});
|
||||
|
||||
describe("capFirst", function() {
|
||||
describe("capFirst", function () {
|
||||
const words = {
|
||||
"rodrigo": "Rodrigo",
|
||||
rodrigo: "Rodrigo",
|
||||
"123m": "123m",
|
||||
"magic mirror": "Magic mirror",
|
||||
",a": ",a",
|
||||
"ñandú": "Ñandú"
|
||||
ñandú: "Ñandú"
|
||||
};
|
||||
|
||||
Object.keys(words).forEach(word => {
|
||||
it(`for '${word}' should return '${words[word]}'`, function() {
|
||||
Object.keys(words).forEach((word) => {
|
||||
it(`for '${word}' should return '${words[word]}'`, function () {
|
||||
expect(Module.definitions.calendar.capFirst(word)).to.equal(words[word]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("getLocaleSpecification", function() {
|
||||
it("Should return a valid moment.LocaleSpecification for a 12-hour format", function() {
|
||||
expect(Module.definitions.calendar.getLocaleSpecification(12)).to.deep.equal({ longDateFormat: {LT: "h:mm A"} });
|
||||
describe("getLocaleSpecification", function () {
|
||||
it("Should return a valid moment.LocaleSpecification for a 12-hour format", function () {
|
||||
expect(Module.definitions.calendar.getLocaleSpecification(12)).to.deep.equal({ longDateFormat: { LT: "h:mm A" } });
|
||||
});
|
||||
|
||||
it("Should return a valid moment.LocaleSpecification for a 24-hour format", function() {
|
||||
expect(Module.definitions.calendar.getLocaleSpecification(24)).to.deep.equal({ longDateFormat: {LT: "HH:mm"} });
|
||||
it("Should return a valid moment.LocaleSpecification for a 24-hour format", function () {
|
||||
expect(Module.definitions.calendar.getLocaleSpecification(24)).to.deep.equal({ longDateFormat: { LT: "HH:mm" } });
|
||||
});
|
||||
|
||||
it("Should return the current system locale when called without timeFormat number", function() {
|
||||
expect(Module.definitions.calendar.getLocaleSpecification()).to.deep.equal({ longDateFormat: {LT: moment.localeData().longDateFormat("LT")} } );
|
||||
it("Should return the current system locale when called without timeFormat number", function () {
|
||||
expect(Module.definitions.calendar.getLocaleSpecification()).to.deep.equal({ longDateFormat: { LT: moment.localeData().longDateFormat("LT") } });
|
||||
});
|
||||
|
||||
it("Should return a 12-hour longDateFormat when using the 'en' locale", function() {
|
||||
it("Should return a 12-hour longDateFormat when using the 'en' locale", function () {
|
||||
var localeBackup = moment.locale();
|
||||
moment.locale("en");
|
||||
expect(Module.definitions.calendar.getLocaleSpecification()).to.deep.equal({ longDateFormat: {LT: "h:mm A"} });
|
||||
expect(Module.definitions.calendar.getLocaleSpecification()).to.deep.equal({ longDateFormat: { LT: "h:mm A" } });
|
||||
moment.locale(localeBackup);
|
||||
});
|
||||
|
||||
it("Should return a 12-hour longDateFormat when using the 'au' locale", function() {
|
||||
it("Should return a 12-hour longDateFormat when using the 'au' locale", function () {
|
||||
var localeBackup = moment.locale();
|
||||
moment.locale("au");
|
||||
expect(Module.definitions.calendar.getLocaleSpecification()).to.deep.equal({ longDateFormat: {LT: "h:mm A"} });
|
||||
expect(Module.definitions.calendar.getLocaleSpecification()).to.deep.equal({ longDateFormat: { LT: "h:mm A" } });
|
||||
moment.locale(localeBackup);
|
||||
});
|
||||
|
||||
it("Should return a 12-hour longDateFormat when using the 'eg' locale", function() {
|
||||
it("Should return a 12-hour longDateFormat when using the 'eg' locale", function () {
|
||||
var localeBackup = moment.locale();
|
||||
moment.locale("eg");
|
||||
expect(Module.definitions.calendar.getLocaleSpecification()).to.deep.equal({ longDateFormat: {LT: "h:mm A"} });
|
||||
expect(Module.definitions.calendar.getLocaleSpecification()).to.deep.equal({ longDateFormat: { LT: "h:mm A" } });
|
||||
moment.locale(localeBackup);
|
||||
});
|
||||
|
||||
it("Should return a 24-hour longDateFormat when using the 'nl' locale", function() {
|
||||
it("Should return a 24-hour longDateFormat when using the 'nl' locale", function () {
|
||||
var localeBackup = moment.locale();
|
||||
moment.locale("nl");
|
||||
expect(Module.definitions.calendar.getLocaleSpecification()).to.deep.equal({ longDateFormat: {LT: "HH:mm"} });
|
||||
expect(Module.definitions.calendar.getLocaleSpecification()).to.deep.equal({ longDateFormat: { LT: "HH:mm" } });
|
||||
moment.locale(localeBackup);
|
||||
});
|
||||
|
||||
it("Should return a 24-hour longDateFormat when using the 'fr' locale", function() {
|
||||
it("Should return a 24-hour longDateFormat when using the 'fr' locale", function () {
|
||||
var localeBackup = moment.locale();
|
||||
moment.locale("fr");
|
||||
expect(Module.definitions.calendar.getLocaleSpecification()).to.deep.equal({ longDateFormat: {LT: "HH:mm"} });
|
||||
expect(Module.definitions.calendar.getLocaleSpecification()).to.deep.equal({ longDateFormat: { LT: "HH:mm" } });
|
||||
moment.locale(localeBackup);
|
||||
});
|
||||
|
||||
it("Should return a 24-hour longDateFormat when using the 'uk' locale", function() {
|
||||
it("Should return a 24-hour longDateFormat when using the 'uk' locale", function () {
|
||||
var localeBackup = moment.locale();
|
||||
moment.locale("uk");
|
||||
expect(Module.definitions.calendar.getLocaleSpecification()).to.deep.equal({ longDateFormat: {LT: "HH:mm"} });
|
||||
expect(Module.definitions.calendar.getLocaleSpecification()).to.deep.equal({ longDateFormat: { LT: "HH:mm" } });
|
||||
moment.locale(localeBackup);
|
||||
});
|
||||
});
|
||||
|
||||
describe("shorten", function() {
|
||||
describe("shorten", function () {
|
||||
const strings = {
|
||||
" String with whitespace at the beginning that needs trimming" : { length: 16, return: "String with whit…" },
|
||||
" String with whitespace at the beginning that needs trimming": { length: 16, return: "String with whit…" },
|
||||
"long string that needs shortening": { length: 16, return: "long string that…" },
|
||||
"short string": { length: 16, return: "short string" },
|
||||
"long string with no maxLength defined": { return: "long string with no maxLength defined" },
|
||||
"long string with no maxLength defined": { return: "long string with no maxLength defined" }
|
||||
};
|
||||
|
||||
Object.keys(strings).forEach(string => {
|
||||
it(`for '${string}' should return '${strings[string].return}'`, function() {
|
||||
Object.keys(strings).forEach((string) => {
|
||||
it(`for '${string}' should return '${strings[string].return}'`, function () {
|
||||
expect(Module.definitions.calendar.shorten(string, strings[string].length)).to.equal(strings[string].return);
|
||||
});
|
||||
});
|
||||
@@ -111,18 +110,15 @@ describe("Functions into modules/default/calendar/calendar.js", function() {
|
||||
});
|
||||
|
||||
it("should wrap the string instead of shorten it if shorten is called with wrapEvents = true (with maxLength defined as 20)", function () {
|
||||
expect(Module.definitions.calendar.shorten(
|
||||
"This is a wrapEvent test. Should wrap the string instead of shorten it if called with wrapEvent = true",
|
||||
20,
|
||||
true)).to.equal("This is a <br>wrapEvent test. Should wrap <br>the string instead of <br>shorten it if called with <br>wrapEvent = true");
|
||||
expect(Module.definitions.calendar.shorten("This is a wrapEvent test. Should wrap the string instead of shorten it if called with wrapEvent = true", 20, true)).to.equal(
|
||||
"This is a <br>wrapEvent test. Should wrap <br>the string instead of <br>shorten it if called with <br>wrapEvent = true"
|
||||
);
|
||||
});
|
||||
|
||||
it("should wrap the string instead of shorten it if shorten is called with wrapEvents = true (without maxLength defined, default 25)", function () {
|
||||
expect(Module.definitions.calendar.shorten(
|
||||
"This is a wrapEvent test. Should wrap the string instead of shorten it if called with wrapEvent = true",
|
||||
undefined,
|
||||
true)).to.equal("This is a wrapEvent <br>test. Should wrap the string <br>instead of shorten it if called <br>with wrapEvent = true");
|
||||
expect(Module.definitions.calendar.shorten("This is a wrapEvent test. Should wrap the string instead of shorten it if called with wrapEvent = true", undefined, true)).to.equal(
|
||||
"This is a wrapEvent <br>test. Should wrap the string <br>instead of shorten it if called <br>with wrapEvent = true"
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
@@ -1,30 +1,32 @@
|
||||
const expect = require("chai").expect;
|
||||
const path = require("path");
|
||||
const {JSDOM} = require("jsdom");
|
||||
const { JSDOM } = require("jsdom");
|
||||
|
||||
describe("Test function cmpVersions in js/module.js", function() {
|
||||
describe("Test function cmpVersions in js/module.js", function () {
|
||||
let cmp;
|
||||
|
||||
before(function(done) {
|
||||
const dom = new JSDOM(`<script>var Class = {extend: function() { return {}; }};</script>\
|
||||
<script src="${path.join(__dirname, "..", "..", "..", "js", "module.js")}">`, { runScripts: "dangerously",
|
||||
resources: "usable" });
|
||||
dom.window.onload = function() {
|
||||
const {cmpVersions} = dom.window;
|
||||
before(function (done) {
|
||||
const dom = new JSDOM(
|
||||
`<script>var Class = {extend: function() { return {}; }};</script>\
|
||||
<script src="${path.join(__dirname, "..", "..", "..", "js", "module.js")}">`,
|
||||
{ runScripts: "dangerously", resources: "usable" }
|
||||
);
|
||||
dom.window.onload = function () {
|
||||
const { cmpVersions } = dom.window;
|
||||
cmp = cmpVersions;
|
||||
done();
|
||||
};
|
||||
});
|
||||
|
||||
it("should return -1 when comparing 2.1 to 2.2", function() {
|
||||
it("should return -1 when comparing 2.1 to 2.2", function () {
|
||||
expect(cmp("2.1", "2.2")).to.equal(-1);
|
||||
});
|
||||
|
||||
it("should be return 0 when comparing 2.2 to 2.2", function() {
|
||||
it("should be return 0 when comparing 2.2 to 2.2", function () {
|
||||
expect(cmp("2.2", "2.2")).to.equal(0);
|
||||
});
|
||||
|
||||
it("should be return 1 when comparing 1.1 to 1.0", function() {
|
||||
it("should be return 1 when comparing 1.1 to 1.0", function () {
|
||||
expect(cmp("1.1", "1.0")).to.equal(1);
|
||||
});
|
||||
});
|
||||
|
@@ -1,8 +1,7 @@
|
||||
/* eslint no-multi-spaces: 0 */
|
||||
var expect = require("chai").expect;
|
||||
|
||||
describe("Functions module currentweather", function() {
|
||||
|
||||
describe("Functions module currentweather", function () {
|
||||
// Fake for use by currentweather.js
|
||||
Module = {};
|
||||
config = {};
|
||||
@@ -11,58 +10,56 @@ describe("Functions module currentweather", function() {
|
||||
Module.definitions[name] = moduleDefinition;
|
||||
};
|
||||
|
||||
before(function(){
|
||||
before(function () {
|
||||
require("../../../modules/default/currentweather/currentweather.js");
|
||||
Module.definitions.currentweather.config = {};
|
||||
});
|
||||
|
||||
describe("roundValue", function() {
|
||||
|
||||
describe("this.config.roundTemp is true", function() {
|
||||
before(function(){
|
||||
describe("roundValue", function () {
|
||||
describe("this.config.roundTemp is true", function () {
|
||||
before(function () {
|
||||
Module.definitions.currentweather.config.roundTemp = true;
|
||||
});
|
||||
|
||||
var values = [
|
||||
// index 0 value
|
||||
// index 1 expect
|
||||
[1 , "1"],
|
||||
[1.0 , "1"],
|
||||
[1.02 , "1"],
|
||||
[10.12 , "10"],
|
||||
[2.0 , "2"],
|
||||
["2.12" , "2"],
|
||||
[10.1 , "10"]
|
||||
[1, "1"],
|
||||
[1.0, "1"],
|
||||
[1.02, "1"],
|
||||
[10.12, "10"],
|
||||
[2.0, "2"],
|
||||
["2.12", "2"],
|
||||
[10.1, "10"]
|
||||
];
|
||||
|
||||
values.forEach(value => {
|
||||
it(`for ${value[0]} should be return ${value[1]}`, function() {
|
||||
values.forEach((value) => {
|
||||
it(`for ${value[0]} should be return ${value[1]}`, function () {
|
||||
expect(Module.definitions.currentweather.roundValue(value[0])).to.equal(value[1]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("this.config.roundTemp is false", function() {
|
||||
|
||||
before(function(){
|
||||
describe("this.config.roundTemp is false", function () {
|
||||
before(function () {
|
||||
Module.definitions.currentweather.config.roundTemp = false;
|
||||
});
|
||||
|
||||
var values = [
|
||||
// index 0 value
|
||||
// index 1 expect
|
||||
[1 , "1.0"],
|
||||
[1.0 , "1.0"],
|
||||
[1.02 , "1.0"],
|
||||
[10.12 , "10.1"],
|
||||
[2.0 , "2.0"],
|
||||
["2.12" , "2.1"],
|
||||
[10.1 , "10.1"],
|
||||
[10.10 , "10.1"]
|
||||
[1, "1.0"],
|
||||
[1.0, "1.0"],
|
||||
[1.02, "1.0"],
|
||||
[10.12, "10.1"],
|
||||
[2.0, "2.0"],
|
||||
["2.12", "2.1"],
|
||||
[10.1, "10.1"],
|
||||
[10.1, "10.1"]
|
||||
];
|
||||
|
||||
values.forEach(value => {
|
||||
it(`for ${value[0]} should be return ${value[1]}`, function() {
|
||||
values.forEach((value) => {
|
||||
it(`for ${value[0]} should be return ${value[1]}`, function () {
|
||||
expect(Module.definitions.currentweather.roundValue(value[0])).to.equal(value[1]);
|
||||
});
|
||||
});
|
||||
|
@@ -1,7 +1,6 @@
|
||||
var expect = require("chai").expect;
|
||||
|
||||
describe("Functions into modules/default/newsfeed/newsfeed.js", function() {
|
||||
|
||||
describe("Functions into modules/default/newsfeed/newsfeed.js", function () {
|
||||
Module = {};
|
||||
Module.definitions = {};
|
||||
Module.register = function (name, moduleDefinition) {
|
||||
@@ -11,21 +10,20 @@ describe("Functions into modules/default/newsfeed/newsfeed.js", function() {
|
||||
// load newsfeed.js
|
||||
require("../../../modules/default/newsfeed/newsfeed.js");
|
||||
|
||||
describe("capitalizeFirstLetter", function() {
|
||||
describe("capitalizeFirstLetter", function () {
|
||||
const words = {
|
||||
"rodrigo": "Rodrigo",
|
||||
rodrigo: "Rodrigo",
|
||||
"123m": "123m",
|
||||
"magic mirror": "Magic mirror",
|
||||
",a": ",a",
|
||||
"ñandú": "Ñandú",
|
||||
ñandú: "Ñandú",
|
||||
".!": ".!"
|
||||
};
|
||||
|
||||
Object.keys(words).forEach(word => {
|
||||
it(`for ${word} should return ${words[word]}`, function() {
|
||||
Object.keys(words).forEach((word) => {
|
||||
it(`for ${word} should return ${words[word]}`, function () {
|
||||
expect(Module.definitions.newsfeed.capitalizeFirstLetter(word)).to.equal(words[word]);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
@@ -1,9 +1,8 @@
|
||||
/* eslint no-multi-spaces: 0 */
|
||||
var expect = require("chai").expect;
|
||||
|
||||
describe("Functions module weatherforecast", function() {
|
||||
|
||||
before(function(){
|
||||
describe("Functions module weatherforecast", function () {
|
||||
before(function () {
|
||||
Module = {};
|
||||
config = {};
|
||||
Module.definitions = {};
|
||||
@@ -14,53 +13,51 @@ describe("Functions module weatherforecast", function() {
|
||||
Module.definitions.weatherforecast.config = {};
|
||||
});
|
||||
|
||||
describe("roundValue", function() {
|
||||
|
||||
describe("this.config.roundTemp is true", function() {
|
||||
before(function(){
|
||||
describe("roundValue", function () {
|
||||
describe("this.config.roundTemp is true", function () {
|
||||
before(function () {
|
||||
Module.definitions.weatherforecast.config.roundTemp = true;
|
||||
});
|
||||
|
||||
var values = [
|
||||
// index 0 value
|
||||
// index 1 expect
|
||||
[1 , "1"],
|
||||
[1.0 , "1"],
|
||||
[1.02 , "1"],
|
||||
[10.12 , "10"],
|
||||
[2.0 , "2"],
|
||||
["2.12" , "2"],
|
||||
[10.1 , "10"]
|
||||
[1, "1"],
|
||||
[1.0, "1"],
|
||||
[1.02, "1"],
|
||||
[10.12, "10"],
|
||||
[2.0, "2"],
|
||||
["2.12", "2"],
|
||||
[10.1, "10"]
|
||||
];
|
||||
|
||||
values.forEach(value => {
|
||||
it(`for ${value[0]} should be return ${value[1]}`, function() {
|
||||
values.forEach((value) => {
|
||||
it(`for ${value[0]} should be return ${value[1]}`, function () {
|
||||
expect(Module.definitions.weatherforecast.roundValue(value[0])).to.equal(value[1]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("this.config.roundTemp is false", function() {
|
||||
|
||||
before(function(){
|
||||
describe("this.config.roundTemp is false", function () {
|
||||
before(function () {
|
||||
Module.definitions.weatherforecast.config.roundTemp = false;
|
||||
});
|
||||
|
||||
var values = [
|
||||
// index 0 value
|
||||
// index 1 expect
|
||||
[1 , "1.0"],
|
||||
[1.0 , "1.0"],
|
||||
[1.02 , "1.0"],
|
||||
[10.12 , "10.1"],
|
||||
[2.0 , "2.0"],
|
||||
["2.12" , "2.1"],
|
||||
[10.1 , "10.1"],
|
||||
[10.10 , "10.1"]
|
||||
[1, "1.0"],
|
||||
[1.0, "1.0"],
|
||||
[1.02, "1.0"],
|
||||
[10.12, "10.1"],
|
||||
[2.0, "2.0"],
|
||||
["2.12", "2.1"],
|
||||
[10.1, "10.1"],
|
||||
[10.1, "10.1"]
|
||||
];
|
||||
|
||||
values.forEach(value => {
|
||||
it(`for ${value[0]} should be return ${value[1]}`, function() {
|
||||
values.forEach((value) => {
|
||||
it(`for ${value[0]} should be return ${value[1]}`, function () {
|
||||
expect(Module.definitions.weatherforecast.roundValue(value[0])).to.equal(value[1]);
|
||||
});
|
||||
});
|
||||
|
@@ -3,7 +3,7 @@ var path = require("path");
|
||||
var expect = require("chai").expect;
|
||||
var vm = require("vm");
|
||||
|
||||
before(function() {
|
||||
before(function () {
|
||||
var basedir = path.join(__dirname, "../../..");
|
||||
|
||||
var fileName = "js/app.js";
|
||||
@@ -15,15 +15,19 @@ before(function() {
|
||||
__dirname: path.dirname(filePath),
|
||||
global: {},
|
||||
console: {
|
||||
log: function() { /*console.log("console.log(", arguments, ")");*/ }
|
||||
log: function () {
|
||||
/*console.log("console.log(", arguments, ")");*/
|
||||
}
|
||||
},
|
||||
process: {
|
||||
on: function() { /*console.log("process.on called with: ", arguments);*/ },
|
||||
on: function () {
|
||||
/*console.log("process.on called with: ", arguments);*/
|
||||
},
|
||||
env: {}
|
||||
}
|
||||
};
|
||||
|
||||
this.sandbox.require = function(filename) {
|
||||
this.sandbox.require = function (filename) {
|
||||
// This modifies the global slightly,
|
||||
// but supplies vm with essential code
|
||||
return require(filename);
|
||||
@@ -32,32 +36,21 @@ before(function() {
|
||||
vm.runInNewContext(code, this.sandbox, fileName);
|
||||
});
|
||||
|
||||
after(function() {
|
||||
after(function () {
|
||||
//console.log(global);
|
||||
});
|
||||
|
||||
describe("Default modules set in modules/default/defaultmodules.js", function() {
|
||||
describe("Default modules set in modules/default/defaultmodules.js", function () {
|
||||
var expectedDefaultModules = ["alert", "calendar", "clock", "compliments", "currentweather", "helloworld", "newsfeed", "weatherforecast", "updatenotification"];
|
||||
|
||||
var expectedDefaultModules = [
|
||||
"alert",
|
||||
"calendar",
|
||||
"clock",
|
||||
"compliments",
|
||||
"currentweather",
|
||||
"helloworld",
|
||||
"newsfeed",
|
||||
"weatherforecast",
|
||||
"updatenotification"
|
||||
];
|
||||
|
||||
expectedDefaultModules.forEach(defaultModule => {
|
||||
it(`contains default module "${defaultModule}"`, function() {
|
||||
expectedDefaultModules.forEach((defaultModule) => {
|
||||
it(`contains default module "${defaultModule}"`, function () {
|
||||
expect(this.sandbox.defaultModules).to.include(defaultModule);
|
||||
});
|
||||
});
|
||||
|
||||
expectedDefaultModules.forEach(defaultModule => {
|
||||
it(`contains a folder for modules/default/${defaultModule}"`, function() {
|
||||
expectedDefaultModules.forEach((defaultModule) => {
|
||||
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);
|
||||
});
|
||||
});
|
||||
|
@@ -3,7 +3,7 @@ var path = require("path");
|
||||
var expect = require("chai").expect;
|
||||
var vm = require("vm");
|
||||
|
||||
before(function() {
|
||||
before(function () {
|
||||
var basedir = path.join(__dirname, "../../..");
|
||||
|
||||
var fileName = "js/app.js";
|
||||
@@ -15,15 +15,19 @@ before(function() {
|
||||
__dirname: path.dirname(filePath),
|
||||
global: {},
|
||||
console: {
|
||||
log: function() { /*console.log("console.log(", arguments, ")");*/ }
|
||||
log: function () {
|
||||
/*console.log("console.log(", arguments, ")");*/
|
||||
}
|
||||
},
|
||||
process: {
|
||||
on: function() { /*console.log("process.on called with: ", arguments);*/ },
|
||||
on: function () {
|
||||
/*console.log("process.on called with: ", arguments);*/
|
||||
},
|
||||
env: {}
|
||||
}
|
||||
};
|
||||
|
||||
this.sandbox.require = function(filename) {
|
||||
this.sandbox.require = function (filename) {
|
||||
// This modifies the global slightly,
|
||||
// but supplies vm with essential code
|
||||
return require(filename);
|
||||
@@ -32,36 +36,28 @@ before(function() {
|
||||
vm.runInNewContext(code, this.sandbox, fileName);
|
||||
});
|
||||
|
||||
after(function() {
|
||||
after(function () {
|
||||
//console.log(global);
|
||||
});
|
||||
|
||||
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"
|
||||
];
|
||||
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"];
|
||||
|
||||
expectedSubPaths.forEach(subpath => {
|
||||
it(`contains a file/folder "${subpath}"`, function() {
|
||||
expectedSubPaths.forEach((subpath) => {
|
||||
it(`contains a file/folder "${subpath}"`, function () {
|
||||
expect(fs.existsSync(path.join(this.sandbox.global.root_path, subpath))).to.equal(true);
|
||||
});
|
||||
});
|
||||
|
||||
it("should not modify global.root_path for testing", function() {
|
||||
it("should not modify global.root_path for testing", function () {
|
||||
expect(global.root_path).to.equal(undefined);
|
||||
});
|
||||
|
||||
it("should not modify global.version for testing", function() {
|
||||
it("should not modify global.version for testing", function () {
|
||||
expect(global.version).to.equal(undefined);
|
||||
});
|
||||
|
||||
it("should expect the global.version equals package.json file", function() {
|
||||
it("should expect the global.version equals package.json file", function () {
|
||||
const versionPackage = JSON.parse(fs.readFileSync("package.json", "utf8")).version;
|
||||
expect(this.sandbox.global.version).to.equal(versionPackage);
|
||||
});
|
||||
|
Reference in New Issue
Block a user