MCPcopy Create free account
hub / github.com/Facets-cloud/flow / TestRenderCardHTML

Function TestRenderCardHTML

internal/app/card_test.go:13–50  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

11)
12
13func 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
52func TestRenderCardHTMLAutomationBand(t *testing.T) {
53 base := stats.Stats{

Callers

nothing calls this directly

Calls 2

renderCardHTMLFunction · 0.85
StringMethod · 0.80

Tested by

no test coverage detected