Merge pull request #2773 from khassel/weather-test-absolute

This commit is contained in:
Michael Teeuw 2022-01-08 07:12:35 +01:00 committed by GitHub
commit ad66c02735
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 43 additions and 1 deletions

View File

@ -12,6 +12,7 @@ _This release is scheduled to be released on 2022-04-01._
### Added ### Added
- Added a config option under the weather module, absoluteDates, providing an option to format weather forecast date output with either absolute or relative dates. - Added a config option under the weather module, absoluteDates, providing an option to format weather forecast date output with either absolute or relative dates.
- Added test for new weather forecast absoluteDates porperty.
### Updated ### Updated

View File

@ -94,7 +94,7 @@
}, },
"jest": { "jest": {
"verbose": true, "verbose": true,
"testTimeout": 10000, "testTimeout": 15000,
"projects": [ "projects": [
{ {
"displayName": "unit", "displayName": "unit",

View File

@ -0,0 +1,27 @@
/* Magic Mirror Test config default weather
*
* By fewieden https://github.com/fewieden
* MIT Licensed.
*/
let config = {
timeFormat: 12,
modules: [
{
module: "weather",
position: "bottom_bar",
config: {
type: "forecast",
location: "Munich",
mockData: '"#####WEATHERDATA#####"',
weatherEndpoint: "/forecast/daily",
absoluteDates: true
}
}
]
};
/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== "undefined") {
module.exports = config;
}

View File

@ -210,6 +210,20 @@ describe("Weather module", function () {
}); });
}); });
describe("Absolute configuration", function () {
beforeAll(function (done) {
startApp("tests/configs/modules/weather/forecastweather_absolute.js", {}, done);
});
it("should render days", function () {
const days = ["Fri", "Sat", "Sun", "Mon", "Tue"];
for (const [index, day] of days.entries()) {
getText(`.weather table.small tr:nth-child(${index + 1}) td:nth-child(1)`, day);
}
});
});
describe("Configuration Options", function () { describe("Configuration Options", function () {
beforeAll(function (done) { beforeAll(function (done) {
startApp("tests/configs/modules/weather/forecastweather_options.js", {}, done); startApp("tests/configs/modules/weather/forecastweather_options.js", {}, done);