package callstest import ( "amadan.net/oficina/estilo.git/busy" "bytes" "os" "path/filepath" "testing" "amadan.net/oficina/estilo.git/theme" "amadan.net/rastrillo/rastrillo/ui" ) // The scaffold delivered these files once; they are app-owned from // then on. This test pins each vendored copy byte-identical to the // library it came from: a reviewer runs the suite instead of reading // ~56KB of assets as app diff, and a framework upgrade that forgets // to re-copy is caught instead of drifting silently. If you edit one // DELIBERATELY, delete its line below — the file is yours. func TestVendoredAssetsMatchTheLibrary(t *testing.T) { // theme.css is no longer day's: it is Calma with Calls' accent, from // estilo (estilo AGENTS.md, decisions table, row 8), pinned below. for name, lib := range map[string][]byte{ "tokens.css": ui.TokensCSS(), "select.js": ui.SelectJS(), } { vendored, err := os.ReadFile(filepath.Join("..", "calls", "static", name)) if err != nil { t.Errorf("read vendored %s: %v", name, err) continue } if !bytes.Equal(vendored, lib) { t.Errorf("static/%s differs from the library copy; re-copy it (or delete its pin if the edit was deliberate)", name) } } } // static/theme.css pinned to the estilo this app is built against. After // an estilo upgrade, re-write it with `go run ./scripts/writeestilo`. func TestThemeIsEstilosForCalls(t *testing.T) { want, ok := theme.ForApp("calls") if !ok { t.Fatal("estilo's theme ring has no calls") } got, err := os.ReadFile(filepath.Join("..", "calls", "static", "theme.css")) if err != nil { t.Fatal(err) } if !bytes.Equal(got, want) { t.Error("static/theme.css differs from estilo's theme for calls; run go run ./scripts/writeestilo") } } // rastrillo's busy rule (Paul, 2026-09-29): a submit button's label gives // way to a spinner for at least 650ms, the button disables, and Back // resets it. static/ carries it as estilo does — the shim without the old // rule, busy.js and busy.css — pinned here to the estilo this app builds // against. After an estilo upgrade: go run ./scripts/writeestilo. func TestBusyFilesAreEstilos(t *testing.T) { for name, want := range map[string][]byte{ "rastrillo.js": busy.ShimJS(), "busy.js": busy.JS(), "busy.css": busy.CSS(), } { got, err := os.ReadFile(filepath.Join("..", "calls", "static", name)) if err != nil { t.Fatal(err) } if !bytes.Equal(got, want) { t.Errorf("static/%s differs from estilo's; run go run ./scripts/writeestilo", name) } } }