Files
pipelines/internal/statusview/status_test.go
T
alan a37a6e0934 First run: friendly empty lists, actionable unreachable server, clearer installer
- CLI: empty list/runs/drafts/skills say so on stderr with the next command
  (stdout and --json unchanged); empty stats skip the zero table; connection
  shows ntfy not configured.
- CLI: a refused or unresolvable server says where it dialled and how to
  start it (pipelines start/doctor, or pipelines serve), redacting the URL.
- skills list/show/import dial the saved client.json address like every
  other server command instead of always 127.0.0.1:8080.
- Status: an unreachable server says how to start it; unconfigured ntfy reads
  as optional phone notifications rather than a Docker misconfiguration.
- Installer: missing tools name where to get them; Docker missing vs not
  running are told apart; the summary ends with numbered next steps (open
  the URL, sign in with the password just chosen, set up harnesses, start a
  chat or example pipeline).
- README: prerequisites, password and a short First steps; install docs
  updated (password rule was stale).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 22:41:02 +00:00

32 lines
1.2 KiB
Go

package statusview
import (
"git.a-wan.net/alan/pipelines/internal/protocol"
"strings"
"testing"
)
func TestOfflineStatusIncludesBothServicesAndRedactsURLCredentials(t *testing.T) {
s := Offline("ws://user:password@localhost:8080/connect?token=secret#secret")
text := strings.Join(Lines(s), "\n")
for _, secret := range []string{"password", "token=", "secret", "user:"} {
if strings.Contains(text, secret) {
t.Fatal("credentials exposed", text)
}
}
for _, expected := range []string{"Pipelines server", "unreachable", "pipelines start", "pipelines serve", "ntfy", "unknown (server unavailable)", "8080"} {
if !strings.Contains(text, expected) {
t.Fatal("missing offline information", expected, text)
}
}
}
func TestUnconfiguredNtfyExplainsConnectedServerAndEndpointMismatch(t *testing.T) {
text := strings.Join(NtfyLines(&protocol.SystemStatus{Ntfy: protocol.ServiceStatus{Health: "not configured"}}), "\n")
for _, want := range []string{"Phone notifications are off", "connected Pipelines server", "(optional)", "docker compose port pipelines 8080", "--url / PIPELINES_URL"} {
if !strings.Contains(text, want) {
t.Fatal("missing endpoint diagnosis", want, text)
}
}
}