Normalize briefing module options and weather stories
This commit is contained in:
@@ -563,6 +563,35 @@ func TestReportModuleOverridesNormalizesConstructedOptionsWithoutMutatingConfig(
|
||||
}
|
||||
}
|
||||
|
||||
func TestReportModuleOverridesCanonicalizesTypedPointerOptions(t *testing.T) {
|
||||
cfg := Defaults()
|
||||
options := &module.AreaForecastDiscussionOptions{Sections: []string{"short_term"}}
|
||||
cfg.Reports = map[string]ReportConfig{
|
||||
"daily": {
|
||||
DeterministicModules: []ModuleConfigItem{
|
||||
{ID: module.Metadata},
|
||||
{ID: module.AreaForecastDiscussion, Options: options},
|
||||
},
|
||||
deterministicModulesSet: true,
|
||||
},
|
||||
}
|
||||
|
||||
overrides, err := cfg.ReportModuleOverrides()
|
||||
if err != nil {
|
||||
t.Fatalf("ReportModuleOverrides() error = %v", err)
|
||||
}
|
||||
got, ok := overrides[report.Daily][1].Options.(module.AreaForecastDiscussionOptions)
|
||||
if !ok {
|
||||
t.Fatalf("override options type = %T, want AreaForecastDiscussionOptions", overrides[report.Daily][1].Options)
|
||||
}
|
||||
if !reflect.DeepEqual(got, *options) {
|
||||
t.Fatalf("override options = %#v, want %#v", got, *options)
|
||||
}
|
||||
if cfg.Reports["daily"].DeterministicModules[1].Options != options {
|
||||
t.Fatalf("config options = %#v, want original pointer %#v", cfg.Reports["daily"].DeterministicModules[1].Options, options)
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateReportModuleAliasesDirectly(t *testing.T) {
|
||||
retiredDailyKey := retiredDailyReportKeyForTest()
|
||||
tests := []struct {
|
||||
|
||||
Reference in New Issue
Block a user