//go:build integration package web // Design 59 test 16's page half (novox/hq ADR 0459 §12, §13; issue 1524, split from 1431): mesh-mail-web // started whole, its stand-in mail-reading.status answering unhealthy with a cause, shows that cause above // the classical list, which still renders. Reuses issue 1285's own harness, its stand-in seat extended to // mail-reading by issue 1523 (standInMailReading, runtime_integration_test.go). Compiled by // `go vet -tags integration ./...`; never run on this machine — the lead's try runs it for real. import ( "io" "net/http" "strings" "testing" ) // 1524/AC3: mesh-mail-web started whole, its stand-in mail-reading.status answering unhealthy with a // cause, shows that cause above the classical list, and the list's accounts still render. func TestAcceptanceUnhealthyMailReadingShowsItsCauseAboveTheStillRenderingList(t *testing.T) { mw := startMailWeb(t, acceptanceAccounts(), []string{"alice"}) mw.store.Accounts = func(map[string]any) (any, error) { return map[string]any{"accounts": []map[string]any{ {"account": "a", "kind": "imap", "address": "a@example.org", "state": "current"}, }}, nil } mw.mailReading.Status = func(map[string]any) (any, error) { return map[string]any{"healthy": false, "cause": "refused", "why": "holds no licence", "since": "2026-10-20T09:30:00Z"}, nil } mw.mailReading.Entries = func(map[string]any) (any, error) { return map[string]any{"entries": []map[string]any{}}, nil } mw.mailReading.Lessons = func(map[string]any) (any, error) { return map[string]any{"lessons": []map[string]any{}}, nil } cookie := signIn(t, mw, "alice", "/") page := doWithCookie(t, mw, http.MethodGet, "/all", nil, cookie) body, _ := io.ReadAll(page.Body) _ = page.Body.Close() if page.StatusCode != http.StatusOK { t.Fatalf("the accounts page: status %d: %s", page.StatusCode, body) } if !strings.Contains(string(body), "Unhealthy") || !strings.Contains(string(body), "refused") || !strings.Contains(string(body), "2026-10-20T09:30:00Z") { t.Fatalf("the page does not show the cause and since when:\n%s", body) } // The classical list — accounts a and c — still renders in full (design 59 test 16; ADR 0459 §13: // "the classical list always opens"). if !strings.Contains(string(body), "a@example.org") { t.Fatalf("the classical list did not render:\n%s", body) } }