Correct daypart identity and display handling
This commit is contained in:
@@ -244,6 +244,35 @@ func TestBuildTodayRenderContext(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestTodayRenderContextPreservesUnicodeDaypartDisplayNames(t *testing.T) {
|
||||
metadata := testTodayMetadata()
|
||||
snapshot := testTodaySnapshot(t)
|
||||
for i := range snapshot.Outputs {
|
||||
if snapshot.Outputs[i].ID != module.DerivedDaypartSummaries {
|
||||
continue
|
||||
}
|
||||
dayparts := snapshot.Outputs[i].Value.(map[string]briefing.DerivedDaypartSummaryModule)
|
||||
morning := dayparts["morning"]
|
||||
morning.DisplayName = "Mañana"
|
||||
dayparts["morning"] = morning
|
||||
}
|
||||
|
||||
ctx, err := BuildTodayRenderContext(metadata, snapshot, Today{
|
||||
Summary: "Today summary.",
|
||||
ForecastDiscussion: []string{"Morning conditions stay quiet."},
|
||||
}, testCollected(), testTodayDerived())
|
||||
if err != nil {
|
||||
t.Fatalf("BuildTodayRenderContext() error = %v", err)
|
||||
}
|
||||
rendered, err := reporttemplate.Render("today", ctx)
|
||||
if err != nil {
|
||||
t.Fatalf("Render() error = %v", err)
|
||||
}
|
||||
if !strings.Contains(string(rendered), "Mañana") {
|
||||
t.Fatalf("rendered report = %q, want Unicode daypart display name", rendered)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuildTodayRenderContextAllowsOmittedOptionalModules(t *testing.T) {
|
||||
snapshot, err := module.NewSnapshot(nil)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user