(t *testing.T)
| 11 | ) |
| 12 | |
| 13 | func TestRenderCardHTML(t *testing.T) { |
| 14 | s := stats.Stats{ |
| 15 | Window: "all-time", |
| 16 | LookupsTotal: 42, |
| 17 | Tokens: stats.Usage{Input: 1000, Output: 500}, |
| 18 | TasksDone: 7, |
| 19 | Savings: stats.Savings{TotalHours: 3.5, TotalDollars: 350, ContextSwitchHours: 2.0}, |
| 20 | DollarPerHour: 100, |
| 21 | LookupsByKind: map[stats.LookupKind]int{stats.LookupResume: 5}, |
| 22 | } |
| 23 | var buf bytes.Buffer |
| 24 | if err := renderCardHTML(&buf, s); err != nil { |
| 25 | t.Fatal(err) |
| 26 | } |
| 27 | html := buf.String() |
| 28 | for _, want := range []string{ |
| 29 | "<!doctype html", |
| 30 | "flow", |
| 31 | "42×", |
| 32 | "context recalls — you never re-explained", |
| 33 | "est.", |
| 34 | "5 instant resumes", |
| 35 | "in context not from scratch", |
| 36 | "your AI remembered, so you didn't", |
| 37 | } { |
| 38 | if !strings.Contains(strings.ToLower(html), strings.ToLower(want)) { |
| 39 | t.Errorf("card html missing %q", want) |
| 40 | } |
| 41 | } |
| 42 | // No automation runs → no $ in output (manual-only user). |
| 43 | if strings.Contains(html, "$") { |
| 44 | t.Errorf("card html should not contain $ when ShowAutomation=false\n---\n%s", html) |
| 45 | } |
| 46 | // Footer must not contain dollar or /hr. |
| 47 | if strings.Contains(html, "/hr") { |
| 48 | t.Errorf("card footer should not contain /hr\n---\n%s", html) |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | func TestRenderCardHTMLAutomationBand(t *testing.T) { |
| 53 | base := stats.Stats{ |
nothing calls this directly
no test coverage detected