Removed deprecated text fields and WindowMinutes from the observations endpoint
All checks were successful
ci/woodpecker/push/build-image Pipeline was successful

This commit is contained in:
2026-03-17 11:15:29 -05:00
parent 0d82e5d60e
commit e3aab86376
2 changed files with 20 additions and 14 deletions

View File

@@ -142,12 +142,21 @@ func TestObservationsCurrentReturnsUSUnits(t *testing.T) {
if _, exists := summary["temperatureC"]; exists {
t.Fatalf("did not expect metric key temperatureC in US response")
}
if _, exists := summary["windowMinutes"]; exists {
t.Fatalf("did not expect deprecated key windowMinutes in observations summary")
}
conditions := payload["conditions"].([]any)
first := conditions[0].(map[string]any)
if got := first["temperatureF"].(float64); got != 50.0 {
t.Fatalf("expected conditions[0].temperatureF=50.0, got %v", got)
}
if _, exists := first["providerRawDescription"]; exists {
t.Fatalf("did not expect deprecated key providerRawDescription in observations condition")
}
if _, exists := first["conditionText"]; exists {
t.Fatalf("did not expect deprecated key conditionText in observations condition")
}
if obsRepo.summaryWin != constants.ObservationWindow || obsRepo.conditionsWin != constants.ObservationWindow || obsRepo.precipWin != constants.ObservationWindow {
t.Fatalf("expected observation window %s to be used", constants.ObservationWindow)
@@ -273,6 +282,9 @@ func TestNullFieldsAreOmittedFromJSON(t *testing.T) {
if _, exists := summary["temperatureF"]; exists {
t.Fatalf("expected summary.temperatureF to be omitted when nil")
}
if _, exists := summary["windowMinutes"]; exists {
t.Fatalf("expected summary.windowMinutes to be omitted")
}
conditions := obsPayload["conditions"].([]any)
firstCond := conditions[0].(map[string]any)