From cd1fe4e182f7ecc4a77ed5815918b235c6e86854 Mon Sep 17 00:00:00 2001 From: Karsten Hassel Date: Fri, 7 Jan 2022 21:32:12 +0100 Subject: [PATCH 1/2] weather test for new absolute property --- CHANGELOG.md | 3 +++ .../weather/forecastweather_absolute.js | 27 +++++++++++++++++++ tests/e2e/modules/weather_spec.js | 14 ++++++++++ 3 files changed, 44 insertions(+) create mode 100644 tests/configs/modules/weather/forecastweather_absolute.js diff --git a/CHANGELOG.md b/CHANGELOG.md index d42eb1d9..6e4b3505 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,9 @@ _This release is scheduled to be released on 2022-04-01._ ### 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 test for new weather forecast absolute porperty. + ### Updated ### Fixed diff --git a/tests/configs/modules/weather/forecastweather_absolute.js b/tests/configs/modules/weather/forecastweather_absolute.js new file mode 100644 index 00000000..92db7acf --- /dev/null +++ b/tests/configs/modules/weather/forecastweather_absolute.js @@ -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; +} diff --git a/tests/e2e/modules/weather_spec.js b/tests/e2e/modules/weather_spec.js index b2dce4fb..6c5afbb0 100644 --- a/tests/e2e/modules/weather_spec.js +++ b/tests/e2e/modules/weather_spec.js @@ -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 () { beforeAll(function (done) { startApp("tests/configs/modules/weather/forecastweather_options.js", {}, done); From e8c0611db47f686df79bff605599464168ddb548 Mon Sep 17 00:00:00 2001 From: Karsten Hassel Date: Fri, 7 Jan 2022 22:00:31 +0100 Subject: [PATCH 2/2] increase test timeout --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ead5d26a..dbf02759 100644 --- a/package.json +++ b/package.json @@ -94,7 +94,7 @@ }, "jest": { "verbose": true, - "testTimeout": 10000, + "testTimeout": 15000, "projects": [ { "displayName": "unit",