Update some tests (#3024)

Co-authored-by: veeck <michael@veeck.de>
This commit is contained in:
Veeck 2023-02-07 00:03:08 +01:00 committed by GitHub
parent bf279d9a57
commit 1dc0a0d5b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 7 deletions

View File

@ -29,7 +29,7 @@ _This release is scheduled to be released on 2023-04-01._
- Update issue template and contributing doc - Update issue template and contributing doc
- The weather modules clearly separates precipation amount and probability (risk of rain/snow) - The weather modules clearly separates precipation amount and probability (risk of rain/snow)
- This requires all providers that only supports probability to change the config from `showPrecipitationAmount` to `showPrecipitationProbability`. - This requires all providers that only supports probability to change the config from `showPrecipitationAmount` to `showPrecipitationProbability`.
- Update weather tests - Update tests for weather and calendar module
- Changed updatenotification module for MagicMirror repo only: Send only notifications for `master` if there is a tag on a newer commit - Changed updatenotification module for MagicMirror repo only: Send only notifications for `master` if there is a tag on a newer commit
- Update dates in Calendar widgets every minute - Update dates in Calendar widgets every minute

View File

@ -7,11 +7,8 @@ describe("Calendar module", () => {
* @param {string} cssClass css selector * @param {string} cssClass css selector
*/ */
const doTest = async (cssClass) => { const doTest = async (cssClass) => {
await helpers.getElement(".calendar"); let elem = await helpers.getElement(".calendar .module-content .event" + cssClass);
await helpers.getElement(".module-content"); expect(await elem.isVisible()).toBe(true);
const events = await global.page.locator(".event");
const elem = await events.locator(cssClass);
expect(elem).not.toBe(null);
}; };
afterEach(async () => { afterEach(async () => {
@ -25,7 +22,7 @@ describe("Calendar module", () => {
}); });
it("has css class tomorrow", async () => { it("has css class tomorrow", async () => {
await helpers.startApplication("tests/configs/modules/calendar/custom.js", "31 Dez 2029 12:30:00 GMT"); await helpers.startApplication("tests/configs/modules/calendar/custom.js", "31 Dec 2029 12:30:00 GMT");
await doTest(".tomorrow"); await doTest(".tomorrow");
}); });
}); });

View File

@ -49,6 +49,11 @@ describe("WeatherObject", () => {
}); });
describe("WeatherUtils", () => { describe("WeatherUtils", () => {
it("should convert windspeed correctly from mps to beaufort", () => {
expect(Math.round(WeatherUtils.convertWind(5, "beaufort"))).toBe(3);
expect(Math.round(WeatherUtils.convertWind(42, "beaufort"))).toBe(12);
});
it("should convert windspeed correctly from mph to mps", () => { it("should convert windspeed correctly from mph to mps", () => {
expect(Math.round(WeatherUtils.convertWindToMetric(93.951324266285))).toBe(42); expect(Math.round(WeatherUtils.convertWindToMetric(93.951324266285))).toBe(42);
}); });
@ -64,4 +69,8 @@ describe("WeatherUtils", () => {
it("should return a calculated feelsLike info", () => { it("should return a calculated feelsLike info", () => {
expect(WeatherUtils.calculateFeelsLike(0, 20, 40)).toBe(-9.444444444444445); expect(WeatherUtils.calculateFeelsLike(0, 20, 40)).toBe(-9.444444444444445);
}); });
it("should return a calculated feelsLike info", () => {
expect(WeatherUtils.calculateFeelsLike(30, 0, 60)).toBe(32.8320322777777);
});
}); });