Add a new narrative forecast module and remove the unimplemented daily forecast stub
This commit is contained in:
@@ -161,9 +161,19 @@ func TestGenerateReportWritesReportAndPreflight(t *testing.T) {
|
||||
if !strings.Contains(string(data), "schema_version: weatherreporter.data_package.v2") ||
|
||||
!strings.Contains(string(data), "recent_changes:") ||
|
||||
!strings.Contains(string(data), "current_conditions:") ||
|
||||
!strings.Contains(string(data), "narrative_forecast:") ||
|
||||
!strings.Contains(string(data), "area_forecast_discussion:") {
|
||||
t.Fatalf("data package missing expected content:\n%s", string(data))
|
||||
}
|
||||
if strings.Contains(string(data), "source_warnings:") {
|
||||
t.Fatalf("data package has source warnings, want none for complete fetched sources:\n%s", string(data))
|
||||
}
|
||||
currentIndex := strings.Index(string(data), " current_conditions:")
|
||||
narrativeIndex := strings.Index(string(data), " narrative_forecast:")
|
||||
summaryIndex := strings.Index(string(data), " derived_daily_summary:")
|
||||
if currentIndex < 0 || narrativeIndex < 0 || summaryIndex < 0 || !(currentIndex < narrativeIndex && narrativeIndex < summaryIndex) {
|
||||
t.Fatalf("data package stanza order is wrong, want current_conditions then narrative_forecast then derived_daily_summary:\n%s", string(data))
|
||||
}
|
||||
savedDataPackage, err := promptinput.LoadYAML(data)
|
||||
if err != nil {
|
||||
t.Fatalf("decode data package: %v", err)
|
||||
@@ -178,6 +188,10 @@ func TestGenerateReportWritesReportAndPreflight(t *testing.T) {
|
||||
if !ok || current["condition_text"] != "Clear" {
|
||||
t.Fatalf("data package current conditions = %#v, want current conditions", savedDataPackage.Briefing.Values["current_conditions"])
|
||||
}
|
||||
narrative, ok := savedDataPackage.Briefing.Values["narrative_forecast"].(map[string]any)
|
||||
if !ok || narrative["product"] != "narrative" || !strings.Contains(string(data), "Morning storms, then partly sunny.") {
|
||||
t.Fatalf("data package narrative forecast = %#v, want narrative forecast", savedDataPackage.Briefing.Values["narrative_forecast"])
|
||||
}
|
||||
story, ok := savedDataPackage.Briefing.Values["weather_story"].(map[string]any)
|
||||
if !ok || story["title"] != "Several Chances for Rain Through Monday" {
|
||||
t.Fatalf("data package weather story = %#v, want weather story title", savedDataPackage.Briefing.Values["weather_story"])
|
||||
@@ -954,8 +968,11 @@ func TestInspectGeneratedReportArtifacts(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("InspectSources() error = %v", err)
|
||||
}
|
||||
if len(sources.Sources) == 0 || len(sources.Warnings) == 0 {
|
||||
t.Fatalf("sources = %#v, want provenance and warnings", sources)
|
||||
if len(sources.Sources) == 0 {
|
||||
t.Fatalf("sources = %#v, want provenance", sources)
|
||||
}
|
||||
if len(sources.Warnings) != 0 {
|
||||
t.Fatalf("sources warnings = %#v, want none for complete fetched sources", sources.Warnings)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user