Skip to content

test(web): cover the untested hooks + components — ratchet moves up#180

Merged
eren23 merged 1 commit into
mainfrom
test/web-quick-wins
Jul 19, 2026
Merged

test(web): cover the untested hooks + components — ratchet moves up#180
eren23 merged 1 commit into
mainfrom
test/web-quick-wins

Conversation

@eren23

@eren23 eren23 commented Jul 19, 2026

Copy link
Copy Markdown
Owner

PR D of the coverage campaign — 68 new tests across the five untested hooks and four untested components:

  • useAscend (critical nav): two-fetch contract, full onAscended payload, all four error surfaces, re-start abort semantics.
  • useContainRect: the fix(web): useContainRect attaches when the image mounts late (+ demo recorder hardening) #48 late-mount regression is now pinned — a null-at-mount ref polls instead of bailing, attaches ResizeObserver when the img appears.
  • useWorldMode (env seed vs stored state), useSharedSession (SSE presence feed via a hand-driven FakeEventSource), useWorldMap (hydrate/fallback/refetch).
  • QueryToolbar, MapLabelOverlay (bbox-beats-geo + frame culls), HintPrompt, MorphImagePair (dive-scale var, shimmer, reduce-motion).

Ratchet: lines 66.0 → 71.9, functions 70.7 → 73.4, branches 85.3 → 86.2; thresholds bumped 65/65/69/84 → 70/70/72/85. 772 web tests + tsc + lint + circular green.

🤖 Generated with Claude Code

68 new tests across the untested web surface:

- hooks/useAscend (8): the two-fetch OUTWARD contract (generate-page
  mode:"ascend" → /api/world/{sid}/ascend persist), optional
  session_style_anchor / suppress_map_labels body fields, the onAscended
  payload (incl. render_unjudged), every error surface (HTTP, stream
  error event, no ascend_ready, persist body), and re-start abort.
- hooks/useWorldMode (8): per-session localStorage persistence +
  rehydrate, garbage coercion, and the NEXT_PUBLIC_WORLD_MODE /
  _DOM_LABELS build-time seeds (stored toggle wins).
- hooks/useSharedSession (8): presence heartbeat → viewers, feed frames
  (hello/presence/node_added), own-page echo filter through the live
  ref, the `unsupported` standalone-Mongo degrade, malformed-frame skip,
  and teardown — over a hand-driven FakeEventSource.
- hooks/useWorldMap (6): hydrate, empty-map fallback (never null with a
  session), best-effort error keep-prior, refetch, session clearing.
- hooks/useContainRect (7): PINS THE #48 REGRESSION — a ref that is null
  at mount polls until the img appears, then attaches ResizeObserver
  (no one-shot bail / invisible marquee); plus letterbox math, the
  null-until-natural-dims contract, load/resize re-measure, cleanup.
- components QueryToolbar (7), MapLabelOverlay (7), HintPrompt (7),
  MorphImagePair (10): render + key interactions per house style.

Coverage (apps/web totals) and the ratchet:

  lines       66.01 → 71.89   floor 65 → 70
  statements  66.01 → 71.89   floor 65 → 70
  functions   70.66 → 73.40   floor 69 → 72
  branches    85.32 → 86.24   floor 84 → 85

Notes: happy-dom drops inline mask-* declarations, so MorphImagePair
pins the ink-bloom branch via its transition target (mask geometry
already covered by lib/morph-style.test.ts) and the ↵ control by its
type=submit wiring. Suite: 98 files / 772 tests green with the new
floors; typecheck, lint (0 errors), check:circular all pass.
@cursor

cursor Bot commented Jul 19, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@eren23
eren23 merged commit d58ee7a into main Jul 19, 2026
9 checks passed
@eren23
eren23 deleted the test/web-quick-wins branch July 19, 2026 08:47
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