Made forecast-period conditionCode optional
This commit is contained in:
@@ -66,7 +66,7 @@ func TestMapForecastPeriodRowNullables(t *testing.T) {
|
||||
period := mapForecastPeriodRow(forecastPeriodRow{
|
||||
StartTime: start,
|
||||
EndTime: end,
|
||||
ConditionCode: 80,
|
||||
ConditionCode: sql.NullInt64{Int64: 80, Valid: true},
|
||||
Name: sql.NullString{String: "Midnight", Valid: true},
|
||||
TemperatureC: sql.NullFloat64{Float64: 12.5, Valid: true},
|
||||
TemperatureCMin: sql.NullFloat64{Valid: false},
|
||||
@@ -84,6 +84,21 @@ func TestMapForecastPeriodRowNullables(t *testing.T) {
|
||||
if !period.StartTime.Equal(start) || !period.EndTime.Equal(end) {
|
||||
t.Fatalf("unexpected time range: %s - %s", period.StartTime, period.EndTime)
|
||||
}
|
||||
if period.ConditionCode == nil || *period.ConditionCode != 80 {
|
||||
t.Fatalf("expected condition code pointer 80, got %v", period.ConditionCode)
|
||||
}
|
||||
}
|
||||
|
||||
func TestMapForecastPeriodRowConditionCodeNullable(t *testing.T) {
|
||||
period := mapForecastPeriodRow(forecastPeriodRow{
|
||||
StartTime: time.Date(2026, 3, 20, 0, 0, 0, 0, time.UTC),
|
||||
EndTime: time.Date(2026, 3, 20, 1, 0, 0, 0, time.UTC),
|
||||
ConditionCode: sql.NullInt64{Valid: false},
|
||||
})
|
||||
|
||||
if period.ConditionCode != nil {
|
||||
t.Fatalf("expected nil condition code, got %v", period.ConditionCode)
|
||||
}
|
||||
}
|
||||
|
||||
func TestMapDiscussionParentRowNullables(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user