Made forecast-period conditionCode optional
All checks were successful
ci/woodpecker/manual/build-image Pipeline was successful
All checks were successful
ci/woodpecker/manual/build-image Pipeline was successful
This commit is contained in:
@@ -63,13 +63,13 @@ func TestMapPostgresEventForecastStructPayload(t *testing.T) {
|
||||
StartTime: time.Date(2026, 3, 16, 19, 0, 0, 0, time.UTC),
|
||||
EndTime: time.Date(2026, 3, 16, 20, 0, 0, 0, time.UTC),
|
||||
IsDay: &isDay,
|
||||
ConditionCode: model.WMOCode(2),
|
||||
ConditionCode: wmoCodePtr(model.WMOCode(2)),
|
||||
TemperatureC: &temp,
|
||||
},
|
||||
{
|
||||
StartTime: time.Date(2026, 3, 16, 20, 0, 0, 0, time.UTC),
|
||||
EndTime: time.Date(2026, 3, 16, 21, 0, 0, 0, time.UTC),
|
||||
ConditionCode: model.WMOCode(3),
|
||||
ConditionCode: nil,
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -94,6 +94,9 @@ func TestMapPostgresEventForecastStructPayload(t *testing.T) {
|
||||
if got := writes[1].Values["period_index"]; got != 0 {
|
||||
t.Fatalf("first period index = %#v, want 0", got)
|
||||
}
|
||||
if got := writes[2].Values["condition_code"]; got != nil {
|
||||
t.Fatalf("second period condition_code = %#v, want nil", got)
|
||||
}
|
||||
|
||||
assertAllWritesIncludeAllColumns(t, writes)
|
||||
}
|
||||
@@ -198,7 +201,7 @@ func TestMapPostgresEventMapPayload(t *testing.T) {
|
||||
{
|
||||
StartTime: time.Date(2026, 3, 16, 19, 0, 0, 0, time.UTC),
|
||||
EndTime: time.Date(2026, 3, 16, 20, 0, 0, 0, time.UTC),
|
||||
ConditionCode: model.WMOCode(2),
|
||||
ConditionCode: wmoCodePtr(model.WMOCode(2)),
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -299,3 +302,8 @@ func tableColumnCounts() map[string]int {
|
||||
}
|
||||
return m
|
||||
}
|
||||
|
||||
func wmoCodePtr(v model.WMOCode) *model.WMOCode {
|
||||
out := v
|
||||
return &out
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user