diff --git a/tests/configs/modules/weather/forecastweather_units.js b/tests/configs/modules/weather/forecastweather_units.js new file mode 100644 index 00000000..c22335f4 --- /dev/null +++ b/tests/configs/modules/weather/forecastweather_units.js @@ -0,0 +1,41 @@ +/* Magic Mirror Test config default weather + * + * By fewieden https://github.com/fewieden + * + * MIT Licensed. + */ + +let config = { + port: 8080, + ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], + + language: "en", + timeFormat: 24, + units: "imperial", + electronOptions: { + webPreferences: { + nodeIntegration: true, + enableRemoteModule: true + } + }, + + modules: [ + { + module: "weather", + position: "bottom_bar", + config: { + type: "forecast", + location: "Munich", + apiKey: "fake key", + weatherEndpoint: "/forecast/daily", + initialLoadDelay: 3000, + decimalSymbol: "_" + } + } + ] +}; + +/*************** 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 cd386f3c..bf7d9af2 100644 --- a/tests/e2e/modules/weather_spec.js +++ b/tests/e2e/modules/weather_spec.js @@ -164,7 +164,7 @@ describe("Weather module", function () { return getText(".weather .normal.medium span:nth-child(2)", "6 WSW") && getText(".weather .large.light span.bright", "34,7°") && getText(".weather .normal.medium.feelslike span.dimmed", "Feels like 22,0°"); }); - it("should render decimalSymbol = ','", async function () { + it("should render custom decimalSymbol = ','", async function () { const weather = generateWeather({ main: { temp: (1.49 * 9) / 5 + 32, @@ -274,5 +274,22 @@ describe("Weather module", function () { expect(rows.length).to.be.equal(5); }); }); + + describe("Forecast weather units", function () { + before(function () { + process.env.MM_CONFIG_FILE = "tests/configs/modules/weather/forecastweather_units.js"; + }); + + it("should render custom decimalSymbol = '_'", async function () { + const weather = generateWeatherForecast(); + await setup({ template, data: weather }); + + const temperatures = ["24_4°", "21_0°", "22_9°", "23_4°", "20_6°"]; + + for (const [index, temp] of temperatures.entries()) { + await getText(`.weather table.small tr:nth-child(${index + 1}) td:nth-child(3)`, temp); + } + }); + }); }); });