From fcf1108641ebf9146f93e2798d6844b15d8cbc5c Mon Sep 17 00:00:00 2001 From: Eric Rakestraw Date: Sun, 14 Jun 2026 05:24:25 +0000 Subject: [PATCH] Strengthen final hourly workflow validation --- internal/cli/root_test.go | 4 +++ .../reporttemplate/reporttemplate_test.go | 30 +++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/internal/cli/root_test.go b/internal/cli/root_test.go index ee3c366..212d077 100644 --- a/internal/cli/root_test.go +++ b/internal/cli/root_test.go @@ -31,6 +31,10 @@ func TestRunHelpLongFlag(t *testing.T) { if !strings.Contains(stdout.String(), "weatherreporter generate hourly") { t.Fatalf("help output missing hourly generate command:\n%s", stdout.String()) } + removedGenerateCommand := "generate " + strings.Join([]string{"near", "term"}, "-") + if strings.Contains(stdout.String(), removedGenerateCommand) { + t.Fatalf("help output includes retired generate command:\n%s", stdout.String()) + } removedInspectCommand := "inspect " + "briefing" if !strings.Contains(stdout.String(), "inspect modules") || strings.Contains(stdout.String(), removedInspectCommand) { t.Fatalf("help output has wrong inspect commands:\n%s", stdout.String()) diff --git a/internal/reporttemplate/reporttemplate_test.go b/internal/reporttemplate/reporttemplate_test.go index d46aa05..e696527 100644 --- a/internal/reporttemplate/reporttemplate_test.go +++ b/internal/reporttemplate/reporttemplate_test.go @@ -96,6 +96,21 @@ func TestRenderHourly(t *testing.T) { t.Fatalf("rendered template missing %q:\n%s", want, text) } } + assertOrderedText(t, text, []string{ + "# Hourly Report", + "## Summary", + "## Timing", + "## Impacts", + "## Confidence", + "## Current Conditions", + "## Hourly Forecast", + "## Precipitation Timing", + "## Alerts", + "## SPC Outlooks", + "## Forecast Discussion", + "## SPC Discussion", + "## Weather Story", + }) } func TestUnknownAssetsReturnActionableErrors(t *testing.T) { @@ -155,3 +170,18 @@ type testForecastDiscussion struct { KeyMessages []string ShortTerm string } + +func assertOrderedText(t *testing.T, text string, ordered []string) { + t.Helper() + previousIndex := -1 + for _, want := range ordered { + index := strings.Index(text, want) + if index < 0 { + t.Fatalf("text missing %q:\n%s", want, text) + } + if index <= previousIndex { + t.Fatalf("%q appears out of order in:\n%s", want, text) + } + previousIndex = index + } +}