Skip to content

Pulse tests: split into node:test files per area - #126

Merged
ajclarkson merged 1 commit into
mainfrom
refactor/pulse-test-split
Nov 8, 2026
Merged

ajclarkson merged 1 commit into
mainfrom
refactor/pulse-test-split

Conversation

@ajclarkson

Copy link
Copy Markdown
Owner

Phase E step 1 of the Pulse quality plan. Tests only: www/pulse-card.js, the YAML and the workflow are untouched (npm test is still the CI command, and the path filter is unchanged).

What changed

tests/pulse-card.test.mjs (319 ok() groups, custom harness) is split into node:test files. Each group is now a test() using node:assert/strict, so a failure is reported on its own and the rest still run. tests/package.json: "test": "node --test".

File Groups Holds (old line ranges)
rooms.test.mjs 53 room pages: render-all, lights story, scenes, individual lights, Presence/Occupied, Automation sheet, room head, registry scenes
attention.test.mjs 7 calm vs attention, attention rows, unexplained_reason
feed.test.mjs 28 history parser, activity rows, timeline, wording table, subsystem table, guard aborts
energy.test.mjs 49 rate chart, price colour, windows, energy page, cost/usage, history, stat tiles
house.test.mjs 26 House page: header, rooms, list, layout and type scale
settings.test.mjs 19 Settings page, house controls, per-room settings
cameras.test.mjs 11 cameras page, toggles, pan/tilt, recordings
tabbar.test.mjs 15 tab bar markup, placement probe, view registration
actions.test.mjs 22 write whitelist, callService, haptics, pending state
heating.test.mjs 26 heating mode control, day plan, heating history
gardens.test.mjs 24 garden lights/theme rows, writes, YAML
element.test.mjs 11 card element (focus, disclosure) and render-cost caching
theme.test.mjs 17 themes, contrast, COPY table
yaml.test.mjs 10 dashboard/view YAML, loader, page paths, info_rooms
golden.test.mjs 1 golden sha256 check against the unchanged fixtures/golden.json

Areas follow how the groups cluster, so heating, gardens, settings, element, theme and golden were added to the suggested list. Shared fixtures (card load under the default theme, mk, withRooms, row parsers, ...) are in tests/helpers.mjs; helpers only one area uses sit at the top of that area's file. Statement order is preserved within each file.

Counts

  • Before: 319 groups passed (node pulse-card.test.mjs); 2292 assert calls (grep -oE "assert(\.[a-zA-Z]+)?\(" | wc -l).
  • After: 319 tests passed, 0 failed (npm test); 2292 assert calls over tests/*.mjs. Nothing dropped.

Checks

  • Temporarily changed one COPY string in the card (not committed): 5 tests failed individually, 314 still ran and passed, the golden check among the failures.
  • PULSE_GOLDEN_WRITE=1 node golden.test.mjs (from tests/) regenerates golden.json; it came out byte-identical.

Run

cd tests && npm ci && npm test, or one area: node --test rooms.test.mjs.

🤖 Generated with Claude Code

https://claude.ai/code/session_016qzFkqmyQUbCRtqsqKXSRv

Each of the 319 ok() groups is now a test(); shared fixtures live in
tests/helpers.mjs, helpers used by one area stay in that area's file.
npm test runs node --test. No change to the card or any YAML.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016qzFkqmyQUbCRtqsqKXSRv
@ajclarkson
ajclarkson merged commit 7ce302d into main Nov 8, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant