Read outlook discussions from Postgres
This commit is contained in:
@@ -168,3 +168,49 @@ func TestMapOutlookRowRejectsInvalidGeometry(t *testing.T) {
|
||||
t.Fatal("expected invalid geometry error")
|
||||
}
|
||||
}
|
||||
|
||||
func TestMapOutlookDiscussionRowMapsFields(t *testing.T) {
|
||||
updatedAt := time.Date(2026, 6, 11, 7, 30, 0, 0, time.FixedZone("CDT", -5*3600))
|
||||
|
||||
discussion := mapOutlookDiscussionRow(outlookDiscussionRow{
|
||||
DiscussionIndex: 2,
|
||||
Day: 2,
|
||||
Headline: sql.NullString{String: "Severe storms possible", Valid: true},
|
||||
Summary: sql.NullString{String: "Scattered severe storms are possible.", Valid: true},
|
||||
Discussion: sql.NullString{String: "Discussion text.", Valid: true},
|
||||
UpdatedAt: sql.NullTime{Time: updatedAt, Valid: true},
|
||||
})
|
||||
|
||||
if discussion.Day != 2 {
|
||||
t.Fatalf("expected day 2, got %d", discussion.Day)
|
||||
}
|
||||
if discussion.Headline != "Severe storms possible" {
|
||||
t.Fatalf("unexpected headline: %q", discussion.Headline)
|
||||
}
|
||||
if discussion.Summary != "Scattered severe storms are possible." {
|
||||
t.Fatalf("unexpected summary: %q", discussion.Summary)
|
||||
}
|
||||
if discussion.Discussion != "Discussion text." {
|
||||
t.Fatalf("unexpected discussion: %q", discussion.Discussion)
|
||||
}
|
||||
if discussion.UpdatedAt == nil || discussion.UpdatedAt.Location().String() != "UTC" {
|
||||
t.Fatalf("expected updatedAt UTC pointer, got %v", discussion.UpdatedAt)
|
||||
}
|
||||
}
|
||||
|
||||
func TestMapOutlookDiscussionRowMissingOptionals(t *testing.T) {
|
||||
discussion := mapOutlookDiscussionRow(outlookDiscussionRow{
|
||||
DiscussionIndex: 1,
|
||||
Day: 1,
|
||||
})
|
||||
|
||||
if discussion.Day != 1 {
|
||||
t.Fatalf("expected day 1, got %d", discussion.Day)
|
||||
}
|
||||
if discussion.Headline != "" || discussion.Summary != "" || discussion.Discussion != "" {
|
||||
t.Fatalf("expected empty optional strings, got %+v", discussion)
|
||||
}
|
||||
if discussion.UpdatedAt != nil {
|
||||
t.Fatalf("expected nil updatedAt, got %v", discussion.UpdatedAt)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user