Rename rolling report to hourly
This commit is contained in:
@@ -28,8 +28,8 @@ func TestRunHelpLongFlag(t *testing.T) {
|
||||
if !strings.Contains(stdout.String(), "generate daily") {
|
||||
t.Fatalf("help output missing generate command:\n%s", stdout.String())
|
||||
}
|
||||
if !strings.Contains(stdout.String(), "weatherreporter generate near-term") {
|
||||
t.Fatalf("help output missing near-term generate command:\n%s", stdout.String())
|
||||
if !strings.Contains(stdout.String(), "weatherreporter generate hourly") {
|
||||
t.Fatalf("help output missing hourly generate command:\n%s", stdout.String())
|
||||
}
|
||||
removedInspectCommand := "inspect " + "briefing"
|
||||
if !strings.Contains(stdout.String(), "inspect modules") || strings.Contains(stdout.String(), removedInspectCommand) {
|
||||
@@ -812,7 +812,7 @@ func TestResolveGenerateCommands(t *testing.T) {
|
||||
}{
|
||||
{name: "daily", args: []string{"daily", "--date", "2026-05-29"}, want: app.ReportDaily},
|
||||
{name: "tomorrow", args: []string{"tomorrow"}, want: app.ReportTomorrow},
|
||||
{name: "near-term", args: []string{"near-term"}, want: app.ReportNearTerm},
|
||||
{name: "hourly", args: []string{"hourly"}, want: app.ReportHourly},
|
||||
{name: "three-day", args: []string{"three-day"}, want: app.ReportThreeDay},
|
||||
{name: "weekend", args: []string{"weekend"}, want: app.ReportWeekend},
|
||||
{name: "storm", args: []string{"storm", "--start", "2026-05-29T18:00", "--end", "2026-05-30T06:00"}, want: app.ReportStorm},
|
||||
@@ -831,20 +831,20 @@ func TestResolveGenerateCommands(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestResolveGenerateNearTermAppliesSharedFlags(t *testing.T) {
|
||||
func TestResolveGenerateHourlyAppliesSharedFlags(t *testing.T) {
|
||||
runner := Runner{Clock: fixedClock()}
|
||||
configPath := filepath.Join(t.TempDir(), "config.yml")
|
||||
if err := os.WriteFile(configPath, []byte("weather_api:\n units: metric\n timezone: UTC\n"), 0o600); err != nil {
|
||||
t.Fatalf("write config: %v", err)
|
||||
}
|
||||
|
||||
req, err := runner.resolveGenerate([]string{"near-term", "--config", configPath, "--units", "us", "--tz", "America/Chicago", "--out", "./near-term.md"})
|
||||
req, err := runner.resolveGenerate([]string{"hourly", "--config", configPath, "--units", "us", "--tz", "America/Chicago", "--out", "./hourly.md"})
|
||||
if err != nil {
|
||||
t.Fatalf("resolveGenerate() error = %v", err)
|
||||
}
|
||||
|
||||
if req.Report != app.ReportNearTerm {
|
||||
t.Fatalf("Report = %q, want near-term", req.Report)
|
||||
if req.Report != app.ReportHourly {
|
||||
t.Fatalf("Report = %q, want hourly", req.Report)
|
||||
}
|
||||
if req.Config.WeatherAPI.Units != "us" {
|
||||
t.Fatalf("Units = %q, want us", req.Config.WeatherAPI.Units)
|
||||
@@ -852,21 +852,21 @@ func TestResolveGenerateNearTermAppliesSharedFlags(t *testing.T) {
|
||||
if req.Config.WeatherAPI.Timezone != "America/Chicago" {
|
||||
t.Fatalf("Timezone = %q, want America/Chicago", req.Config.WeatherAPI.Timezone)
|
||||
}
|
||||
if req.OutputPath != "./near-term.md" {
|
||||
t.Fatalf("OutputPath = %q, want ./near-term.md", req.OutputPath)
|
||||
if req.OutputPath != "./hourly.md" {
|
||||
t.Fatalf("OutputPath = %q, want ./hourly.md", req.OutputPath)
|
||||
}
|
||||
if !req.Date.IsZero() || !req.StormStart.IsZero() || !req.StormEnd.IsZero() {
|
||||
t.Fatalf("date/storm bounds = %s/%s/%s, want unset for near-term", req.Date, req.StormStart, req.StormEnd)
|
||||
t.Fatalf("date/storm bounds = %s/%s/%s, want unset for hourly", req.Date, req.StormStart, req.StormEnd)
|
||||
}
|
||||
}
|
||||
|
||||
func TestResolveGenerateNearTermRejectsDateAndStormBounds(t *testing.T) {
|
||||
func TestResolveGenerateHourlyRejectsDateAndStormBounds(t *testing.T) {
|
||||
runner := Runner{Clock: fixedClock()}
|
||||
|
||||
for _, args := range [][]string{
|
||||
{"near-term", "--date", "2026-05-29"},
|
||||
{"near-term", "--start", "2026-05-29T18:00"},
|
||||
{"near-term", "--end", "2026-05-29T20:00"},
|
||||
{"hourly", "--date", "2026-05-29"},
|
||||
{"hourly", "--start", "2026-05-29T18:00"},
|
||||
{"hourly", "--end", "2026-05-29T20:00"},
|
||||
} {
|
||||
_, err := runner.resolveGenerate(args)
|
||||
if err == nil {
|
||||
|
||||
Reference in New Issue
Block a user