mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-07-03 22:36:09 +00:00
Add test for decimalSymbol in weatherforecast
This commit is contained in:
parent
f8769fcc2a
commit
e6fea297e5
41
tests/configs/modules/weather/forecastweather_units.js
Normal file
41
tests/configs/modules/weather/forecastweather_units.js
Normal file
@ -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;
|
||||||
|
}
|
@ -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°");
|
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({
|
const weather = generateWeather({
|
||||||
main: {
|
main: {
|
||||||
temp: (1.49 * 9) / 5 + 32,
|
temp: (1.49 * 9) / 5 + 32,
|
||||||
@ -274,5 +274,22 @@ describe("Weather module", function () {
|
|||||||
expect(rows.length).to.be.equal(5);
|
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);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user