Files
serverAppConfigs/tests/homepage_pages.bats
T
Frank 01c42202b8 Homepage (TDD slice 4): the pages, theme, and toggle
Red tests first, then the pages.
- tests/homepage_pages.bats: the pages reference the data + theme; no
  auto-refresh (Q41); no cursor alteration (Q28); the styling toggle strips
  to bare HTML (Q27); the footer shows the last master deployment datetime
  (Q43).
- index.html / admin.html: the user and admin pages. A grid of TUI panels,
  a summary line, the bare toggle, the deployed-at footer.
- app.js: reads status.json + services.json once (no auto-refresh), renders
  one panel per service for the page's category, the toggle, the footer.
- style.css: the terminal TUI theme (green-on-black, phosphor palette,
  scanlines) + a ?bare=1 mode that strips to unstyled HTML. No custom cursor.

Functionally verified with a Node DOM shim: 9 user panels, correct summary,
correct footer datetime.
2026-08-23 12:26:31 -07:00

46 lines
1.4 KiB
Bash

#!/usr/bin/env bats
# Seam: the homepage pages (index.html, admin.html, app.js, style.css).
# A browser cannot run under bats, so the tests assert the public contract
# statically: the pages reference the data and the theme, the page does not
# auto-refresh (Q41), does not alter the user's cursor (Q28), offers the
# styling toggle (Q27), and shows the last master deployment datetime (Q43).
load helpers
setup() {
BASE="$REPO_ROOT/shared/homepage"
}
@test "pages exist and reference the data and the theme" {
[ -f "$BASE/index.html" ]
[ -f "$BASE/admin.html" ]
[ -f "$BASE/app.js" ]
[ -f "$BASE/style.css" ]
for f in app.js style.css; do
grep -q "$f" "$BASE/index.html"
grep -q "$f" "$BASE/admin.html"
done
grep -q "status.json" "$BASE/app.js"
grep -q "services.json" "$BASE/app.js"
}
@test "the page does not auto-refresh (Q41)" {
! grep -q "setInterval" "$BASE/app.js"
! grep -qi "poll" "$BASE/app.js"
}
@test "the page does not alter the user's cursor (Q28)" {
! grep -qE "cursor:[[:space:]]*(none|url\()" "$BASE/style.css"
}
@test "the styling toggle strips to bare HTML (Q27)" {
grep -q "data-bare" "$BASE/style.css"
grep -q "bare" "$BASE/app.js"
}
@test "the footer shows the last master deployment datetime (Q43)" {
grep -q "deployed-at" "$BASE/index.html"
grep -q "deployed-at" "$BASE/admin.html"
grep -q "deployed-at" "$BASE/app.js"
}