Strengthen final hourly workflow validation
This commit is contained in:
@@ -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())
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user