Add data package export regression coverage
This commit is contained in:
@@ -59,6 +59,43 @@ func TestDefaultReportModulesBuildSnapshots(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestDefaultModuleDefinitionsDeclarePromptExportPolicy(t *testing.T) {
|
||||
customExporters := map[module.ID]struct{}{
|
||||
module.CurrentConditions: {},
|
||||
module.HourlyForecast: {},
|
||||
module.DerivedDaypartSummaries: {},
|
||||
}
|
||||
passThroughExporters := map[module.ID]struct{}{
|
||||
module.Metadata: {},
|
||||
module.NarrativeForecast: {},
|
||||
module.DerivedDailySummary: {},
|
||||
module.PrecipTiming: {},
|
||||
module.AlertDigest: {},
|
||||
module.SPCConvectiveOutlooks: {},
|
||||
module.AreaForecastDiscussion: {},
|
||||
module.SPCConvectiveDiscussion: {},
|
||||
module.WeatherStory: {},
|
||||
module.OutdoorWindows: {},
|
||||
module.TodayPlanning: {},
|
||||
module.TomorrowPlanning: {},
|
||||
module.DailyPlanning: {},
|
||||
}
|
||||
|
||||
for _, definition := range defaultModuleDefinitions() {
|
||||
_, custom := customExporters[definition.ID]
|
||||
_, passThrough := passThroughExporters[definition.ID]
|
||||
if custom == passThrough {
|
||||
t.Fatalf("module %q exporter policy custom=%v passThrough=%v, want exactly one policy", definition.ID, custom, passThrough)
|
||||
}
|
||||
if custom && definition.PromptExporter == nil {
|
||||
t.Fatalf("module %q PromptExporter = nil, want custom prompt exporter", definition.ID)
|
||||
}
|
||||
if passThrough && definition.PromptExporter != nil {
|
||||
t.Fatalf("module %q PromptExporter is set, want default pass-through", definition.ID)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestModuleRegistryAddsPassThroughPromptValue(t *testing.T) {
|
||||
registry, err := NewModuleRegistry([]ModuleDefinition{
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user