mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-09-15 00:22:49 +00:00
Update feels_like temperature formula (#3869)
The current logic never showed any different temperature than the current one, so I looked into a more "explained" formula and found one in the HomeAssistant forums.
This commit is contained in:
@@ -3,9 +3,17 @@ const WeatherUtils = require("../../../../../modules/default/weather/weatherutil
|
||||
|
||||
describe("Weather utils tests", () => {
|
||||
describe("temperature conversion to imperial", () => {
|
||||
it("should convert temp correctly from Celsius to Celsius", () => {
|
||||
expect(Math.round(WeatherUtils.convertTemp(10, "metric"))).toBe(10);
|
||||
});
|
||||
|
||||
it("should convert temp correctly from Celsius to Fahrenheit", () => {
|
||||
expect(Math.round(WeatherUtils.convertTemp(10, "imperial"))).toBe(50);
|
||||
});
|
||||
|
||||
it("should convert temp correctly from Fahrenheit to Celsius", () => {
|
||||
expect(Math.round(WeatherUtils.convertTempToMetric(10))).toBe(-12);
|
||||
});
|
||||
});
|
||||
|
||||
describe("windspeed conversion to beaufort", () => {
|
||||
@@ -44,11 +52,11 @@ describe("Weather utils tests", () => {
|
||||
|
||||
describe("feelsLike calculation", () => {
|
||||
it("should return a calculated feelsLike info (negative value)", () => {
|
||||
expect(WeatherUtils.calculateFeelsLike(0, 20, 40)).toBe(-9.444444444444445);
|
||||
expect(WeatherUtils.calculateFeelsLike(0, 20, 40)).toBe(-9.397005931555448);
|
||||
});
|
||||
|
||||
it("should return a calculated feelsLike info (positive value)", () => {
|
||||
expect(WeatherUtils.calculateFeelsLike(30, 0, 60)).toBe(32.8320322777777);
|
||||
expect(WeatherUtils.calculateFeelsLike(30, 0, 60)).toBe(32.832032277777756);
|
||||
});
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user