Updated the current_conditions module to round all numeric values to integers

This commit is contained in:
2026-06-14 17:40:19 -05:00
parent 74e32eb18e
commit 5344c7880a
5 changed files with 48 additions and 45 deletions

View File

@@ -234,7 +234,10 @@ func TestCurrentConditionsModuleUsesSnakeCaseUnitFields(t *testing.T) {
}
value := moduleValue[CurrentConditionsModule](t, output)
if value.ConditionText != "Partly cloudy" || value.ConditionTextLower != "partly cloudy" || value.TemperatureF == nil || *value.TemperatureF != 74 {
t.Fatalf("CurrentConditions = %#v, want current condition facts", value)
t.Fatalf("CurrentConditions = %#v, want rounded current condition facts", value)
}
if value.ApparentTemperatureF == nil || *value.ApparentTemperatureF != 76 || value.RelativeHumidityPercent == nil || *value.RelativeHumidityPercent != 71 || value.WindSpeedMph == nil || *value.WindSpeedMph != 8 {
t.Fatalf("CurrentConditions rounded values = %#v, want apparent 76, humidity 71, wind 8", value)
}
if value.WindDirection != "S" {
t.Fatalf("WindDirection = %q, want S", value.WindDirection)
@@ -403,10 +406,10 @@ func testModuleContext() ModuleContext {
},
}
isDay := true
tempF := 74.0
apparentF := 76.0
humidity := 71.0
windMph := 8.0
tempF := 74.4
apparentF := 75.6
humidity := 70.6
windMph := 8.4
windDirection := 190.0
narrativeTempF := 81.0
narrativePop := 60.0