Repository navigation
test(ui): cover the tab components' interaction and rendering paths - #591
Conversation
- Finalize: no-op without a flusher, recorded chunk errors surfaced as-is (distinguished from the flush wrap), flush failures wrapped, and an empty recording still writes chunk zero because playback always requests it - HandleAddSoldier: a rejoining player keeps their player flag and unit name - HandleAddVehicle: a re-sent Add replaces the record; HandleVehicleState registers unknown vehicles from the state's own capture frame - seedChunkBoundaries: vehicles are seeded alongside soldiers, entities deleted before a boundary are left out, and a failed seed surfaces its write error - derivePlacedObjects: magazine-icon fallback, minefield default, explicit icon precedence, earliest lifecycle event wins the end frame, hits attribute to the placer with vehicle victims keeping the vehicle id, and unknown/victim-less events are skipped - eventsToV1/markersToV1: vehicle ids win victim/killer slots; polylines carry geometry only (matching the pinned v2 writer) while plain markers append a position per state - sideToIndex, projectileEndPos, positionFromExtra, decodePayload: pinned directly, including malformed-payload rejection - WriteJSONGzNamed: gzip artifact readable back, missing output dir fails at create time - writeFileAtomic: rename onto a directory and a missing directory both fail loudly; removeSidecar errors propagate; WriteSidecars aborts on encoder failure and surfaces write failures Verified each behavioral pin fails when the guarded code is broken coverage: ingestion 85.1% -> 90.5%, storage 93.5% -> 94.2%
- CommsTab (57.6% -> 97.2% statements, 26.3% -> 78.9% branches): heard counts against out-of-range peers, click-to-seek opening the net, pan-to-member, the transmission window, search matching speaker/radio/net with the no-match notes, net narrowing with member auto-expand, unknown-unit fallbacks with no range guess, and the no-data placeholder - OrbatTab (69.4% -> 94.0%): member and role search keeping only hits, the player-faction preselection and explicit picks, follow-on-click, vehicle search by name and by crew, and the empty vehicle note - EventsTab (73.3% -> 92.0%): rendering, click-pan and search haystacks for zeus pings/modules, servicing, static weapons and transmissions - StatsTab (82.5% -> 99.7%): wind direction without a speed sample, gusts, lightnings and waves, movement ranking with formatted distances, and the no-movement note - PlayerProfileDiff (55.3% -> 99.0%, branches 98.4%): every field kind through the grid, body parts, treatments, medical logs, rounds deltas per polarity, radio and stamina views, and the empty-state variants Test-only: no production file is touched. Engine snapshot effects settle on the microtask queue, so seek-dependent assertions await a settle pass first, matching the existing overlay test conventions overall UI coverage: 91.4% -> 94.7% statements, 80.9% -> 83.9% branches, 93.6% -> 96.2% lines
smitt14ua
left a comment
There was a problem hiding this comment.
Test-only, good coverage bump with meaningful interaction tests (seek/pan/follow on click, search haystacks, faction preselection). Locally: tsc --noEmit clean, eslint has no new warnings, recording-playback suite green (656 tests). Heads-up: this branch also carries the Go commit from #590, so merge #590 first and this diff will shrink to the UI files. A few small test-quality nits below, nothing blocking. Approving.
Details
Verified locally (Windows, branch claude/coverage-ui-tabs @ 99e66105):
npx tsc --noEmit— cleannpx eslint src/pages/recording-playback— 0 errors. The 2 warnings are inPlayerProfileCard.tsx/profileDiff.ts, which this PR doesn't touch.npx vitest run src/pages/recording-playback— 43 files / 656 tests pass
Branch structure: commit c001c525 (test(go): cover ingestion finalize lifecycle…) is the same commit as in #590, so the PR shows internal/ingestion/lifecycle_test.go and internal/storage/precompress_test.go as changes. Merge order: #590 → #591. Otherwise this PR merges #590's content implicitly.
Nits (non-blocking):
-
Mid-file imports.
CommsTab.test.tsx:import { vi } from "vitest";is added after the firstdescribeblock. Move it into the existing top-levelvitestimport.PlayerProfileDiff.test.tsx: same withimport { MedicalDiffView, RadioDiffView, StaminaDiffView, DiffEmpty } from "../PlayerProfileDiff";and thetypeimport from../../profileDiff.
ES imports are hoisted, so it works, but it's easy to miss when reading.
-
Double
I18nProviderinPlayerProfileDiff.test.tsx.renderView()already wrapsui()in<I18nProvider locale="en">, and every call site wraps its view in another<I18nProvider locale="en">. Drop one of the two, most naturally the inner one at the call sites. -
Vacuous or missing assertions:
EventsTab.test.tsx› "searches chat messages, transmissions and module names": the finalexpect(screen.queryByTestId("event-row-0")).toBeNull()can never fail, because no event sits at frame 0 (rows are 5/10/15/20). Assert the rows that were visible before are gone (event-row-5,event-row-10,event-row-15), or assert the no-match message.OrbatTab.test.tsx› "narrows groups to a member-name hit…": the comment says "with the recounted strength 1/2", and the PR description says "strength recounted", but onlygetByText("Alpha")is asserted. Add an assertion on the strength text, or drop the claim.CommsTab.test.tsx› "narrows nets to a member hit…": the net-label search ("200") is described as "lists the net without expanding it", but only the header's presence is checked. Addexpect(header("200 MHz").getAttribute("aria-expanded")).toBe("false")(orqueryByText("Charlie")→ null) to actually pin the no-expand behaviour.
-
Minor cleanup:
asyncwithoutawaitin OrbatTab "follows a member when their row is clicked".- Double blank lines between the helpers in
CommsTab.test.tsx. EventsTab.test.tsxadds its ownradioTransmission(frameNum, action, frequency)helper, andCommsTab.test.tsxaddstransmission(frameNum, unitId, action, frequency)with the same payload shape. Could live intestHelpersnext toradioSnapshot.
CI (UI › check) is SKIPPED while the PR is a draft. It needs to run once it's marked ready.
Merging this branch will increase overall coverage
Coverage detailsCompared to commit f4cfae4 (run #40201649259) Changed unit test files:
|
Summary
Raises overall UI coverage to 94.7% statements / 83.9% branches / 96.2% lines (from 91.4 / 80.9 / 93.6). Test-only — no production file is touched.
CommsTab.tsxOrbatTab.tsxEventsTab.tsxStatsTab.tsxPlayerProfileDiff.tsxWhat's pinned
CommsTab — heard counts against out-of-range peers (one net, two peers at different distances:
1/2); clicking a transmission seeks to its start and opens its net; clicking a roster member pans to them; the ±window keeps distant transmissions out of the list; search matches speaker, radio model and formatted net, each with its no-match note; a member hit narrows the net and auto-expands it while a net-label hit lists without expanding; a speaker with no entity resolves toUnit 9and, without a snapshot radio, silently uses the addon's fallback range (no heard count); the no-data placeholder.OrbatTab — a member-name hit keeps only that member with strength recounted; role matches work; junk searches show the no-match note; the faction with players is preselected and an explicit pick of a player-less faction sticks (and returns); member clicks follow; vehicles are searchable by their own name and by anyone who ever crewed them; the no-player-vehicles note.
EventsTab — rendering, click-pan target and search haystacks for zeus pings, zeus modules, servicing (including the rearm magazine detail), static weapons and transmissions; transmissions and chat are toggled through the filter panel since both default off.
StatsTab — wind direction reported without a speed sample; gusts, lightnings and waves rows; movement ranking with formatted distances (
200 m,1.0 km, Runner ranked above Walker) and the no-movement note.PlayerProfileDiff — every field kind through the grid (number, percent, bool, blood pressure with the no-pressure fallback, hemorrhage levels, stance labels, plain text), body parts with damage and items, treatments, medical logs, rounds deltas for each polarity (added keeps the new count, removed keeps the old, changed shows
from → to), radio rows per polarity, the stamina view, and both empty-state variants.Test conventions
Engine snapshot effects settle on the microtask queue after a seek, so seek-dependent assertions await a settle pass first — the same pattern the overlay tests use. Chat fields are top-level on the event def (not
payload), matching the factory signature.Verification
Click-through tests were mutation-checked: removing the
seekTofrom the transmission click handler, thefollowEntityfrom the member row, and thepanToEntityfrom the transmission row each fails its test. Full suite: 2268 passed / 13 skipped on the branch (2304 after merging current main),npx tsc --noEmitclean.