Revise the report template for the tomorrow report.

This commit is contained in:
2026-06-14 23:26:45 -05:00
parent 74bd69834c
commit 473f252aee
6 changed files with 409 additions and 93 deletions

View File

@@ -220,23 +220,39 @@ func TestRenderTomorrow(t *testing.T) {
},
Modules: testTomorrowModules{
Dayparts: []testTomorrowDaypart{
{
Key: "overnight",
Summary: testDaypartSummary{
DisplayName: "Overnight",
TemperatureTrend: "falling",
TemperatureStartPhraseF: "mid 60s",
TemperatureEndPhraseF: "upper 50s",
DominantConditionDisplay: "Partly cloudy",
DominantConditionLower: "partly cloudy",
},
},
{
Key: "morning",
Summary: testDaypartSummary{
DisplayName: "Morning",
TemperaturePhraseF: "low 60s",
DominantConditionLower: "partly cloudy",
DisplayName: "Morning",
TemperatureTrend: "rising",
TemperatureStartPhraseF: "upper 50s",
TemperatureEndPhraseF: "upper 60s",
DominantConditionDisplay: "Sunny",
DominantConditionLower: "sunny",
},
},
{
Key: "afternoon",
Summary: testDaypartSummary{
DisplayName: "Afternoon",
TemperaturePhraseF: "mid 70s",
DominantConditionLower: "showers",
MaxPopPercent: intPtr(70),
MaxPopTimeLabel: "3:00 PM",
MentionPrecipitation: true,
DisplayName: "Afternoon",
TemperatureTrend: "steady",
TemperatureSteadyPhraseF: "upper 70s",
DominantConditionDisplay: "Sunny",
DominantConditionLower: "sunny",
MaxPopPercent: intPtr(70),
MaxPopTimeLabel: "3:00 PM",
MentionPrecipitation: true,
},
},
},
@@ -256,8 +272,9 @@ func TestRenderTomorrow(t *testing.T) {
"**Forecast date:** Monday, June 15, 2026",
"**Updated:** Sunday, June 14, 2026 at 9:14 AM",
"Tomorrow starts dry before showers return later in the day.",
"- **Morning:** low 60s and partly cloudy.",
"- **Afternoon:** mid 70s and showers. Precipitation chances peak at 70% at 3:00 PM.",
"- **Overnight:** Partly cloudy, with temperatures falling from the mid 60s to the upper 50s.",
"- **Morning:** Sunny, with temperatures rising from the upper 50s to the upper 60s.",
"- **Afternoon:** Sunny, with temperatures in the upper 70s. Chance of precipitation is 70%.",
"- **3:00 PM** to **6:00 PM**: Precipitation is expected during this period. The peak precipitation chance is 70% at 3:00 PM.",
"A few showers may linger into early evening.",
"Clouds increase after sunrise.",
@@ -267,9 +284,18 @@ func TestRenderTomorrow(t *testing.T) {
t.Fatalf("rendered template missing %q:\n%s", want, text)
}
}
for _, unwanted := range []string{
"upper 50s.\n\n- **Morning:**",
"upper 60s.\n\n- **Afternoon:**",
} {
if strings.Contains(text, unwanted) {
t.Fatalf("rendered template includes blank lines between daypart bullets:\n%s", text)
}
}
assertOrderedText(t, text, []string{
"# Monday's Weather",
"## Daypart Forecast",
"- **Overnight:**",
"- **Morning:**",
"- **Afternoon:**",
"## Precipitation Timing",
@@ -296,9 +322,11 @@ func TestRenderTomorrowOmitsPrecipitationTimingWithoutWindows(t *testing.T) {
{
Key: "morning",
Summary: testDaypartSummary{
DisplayName: "Morning",
TemperaturePhraseF: "low 60s",
DominantConditionLower: "clear",
DisplayName: "Morning",
TemperatureTrend: "steady",
TemperatureSteadyPhraseF: "low 60s",
DominantConditionDisplay: "Clear",
DominantConditionLower: "clear",
},
},
},
@@ -436,15 +464,21 @@ type testTomorrowDaypart struct {
}
type testDaypartSummary struct {
DisplayName string
TempRangeF string
TemperaturePhraseF string
MaxPopPercent *int
MaxPopTime string
MaxPopTimeLabel string
MentionPrecipitation bool
DominantCondition string
DominantConditionLower string
DisplayName string
TempRangeF string
TemperaturePhraseF string
TemperatureTrend string
TemperatureStartPhraseF string
TemperatureEndPhraseF string
TemperaturePeakPhraseF string
TemperatureSteadyPhraseF string
MaxPopPercent *int
MaxPopTime string
MaxPopTimeLabel string
MentionPrecipitation bool
DominantCondition string
DominantConditionLower string
DominantConditionDisplay string
}
type testCurrentConditions struct {