mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-21 12:55:22 +00:00
Fix API version in yr weather provider call (#3223)
Fixes #3227 and also - removes unused code - de-duplicates code fragments - fixes typos - inlines code - adds more weather util tests @martingron and @Justheretoreportanissue would you be so kind to check if I didnt mess anything up?
This commit is contained in:
@@ -2,6 +2,12 @@ const weather = require("../../../../../modules/default/weather/weatherutils");
|
||||
const WeatherUtils = require("../../../../../modules/default/weather/weatherutils");
|
||||
|
||||
describe("Weather utils tests", () => {
|
||||
describe("windspeed conversion", () => {
|
||||
it("should convert temp correctly from Celsius to Fahrenheit", () => {
|
||||
expect(Math.round(WeatherUtils.convertTemp(10, "imperial"))).toBe(50);
|
||||
});
|
||||
});
|
||||
|
||||
describe("windspeed conversion", () => {
|
||||
it("should convert windspeed correctly from mps to beaufort", () => {
|
||||
expect(Math.round(WeatherUtils.convertWind(5, "beaufort"))).toBe(3);
|
||||
@@ -32,6 +38,7 @@ describe("Weather utils tests", () => {
|
||||
describe("wind direction conversion", () => {
|
||||
it("should convert wind direction correctly from cardinal to value", () => {
|
||||
expect(WeatherUtils.convertWindDirection("SSE")).toBe(157);
|
||||
expect(WeatherUtils.convertWindDirection("XXX")).toBe(null);
|
||||
});
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user