package app import ( "bytes" "context" "os" "path/filepath" "strings" "testing" ) func TestRunDryRunPrintsConfigSummary(t *testing.T) { configPath := filepath.Join(t.TempDir(), "config.yml") err := os.WriteFile(configPath, []byte(` pipelines: - id: reports source: backend: local path: /source destinations: - id: archive backend: local path: /archive `), 0o600) if err != nil { t.Fatalf("write config: %v", err) } var stdout bytes.Buffer err = Run(context.Background(), RunOptions{ ConfigPath: configPath, DryRun: true, Stdout: &stdout, }) if err != nil { t.Fatalf("Run() error = %v", err) } output := stdout.String() for _, want := range []string{ "Configured pipelines: 1", "- reports: source=local destinations=1", "archive: backend=local publish_source=true publish_html=false", } { if !strings.Contains(output, want) { t.Fatalf("Run() output = %q, want substring %q", output, want) } } } func TestRunWithoutDryRunIsNotImplemented(t *testing.T) { err := Run(context.Background(), RunOptions{}) if err == nil || !strings.Contains(err.Error(), "not implemented") { t.Fatalf("Run() error = %v, want not implemented", err) } }