Give src/client/reportPanel.ts the test the rest of the HUD has, and let the layout claim it makes be checked instead of eyeballed.
src/client/report.ts is tested; reportPanel.ts — the 64 lines that turn those strings into pixels during the round-over delay — is one of only two client modules with no test file beside it. It carries real arithmetic worth pinning: rows counts the panel's height from the number of lines and the two empty cases, MAX_LINES caps at five, w clamps to width - 24 on a narrow screen, and the whole thing draws nothing unless world.match.phase === "over". hud.test.ts:20 already has a recorder() that hands back a fake 2D context and the list of calls it received, which is all this needs.
Done looks like:
[ ] src/client/reportPanel.test.ts exists and drives drawReport through a recording context; the recorder is shared rather than copied — lift recorder() into a small test helper both files import, or export it from one, whichever keeps hud.test.ts unchanged in behaviour.
[ ] Tests that fail without the change: nothing is drawn in freeze, live or planted; the panel appears in over; a round with no damage either way draws "nothing" twice; six opponents hit draws five lines, not six; the panel's width never exceeds the canvas at 360px; the total line reads what report() says.
[ ] No behaviour change to reportPanel.ts unless a test finds a real bug — if it does, fix the code and say so in the pull.
[ ] bun run check green.
Files I expect to change: new src/client/reportPanel.test.ts, a shared recorder (src/client/hud.test.ts or a new src/client/recorder.test-helper.ts — match whatever the repo does elsewhere), and src/client/reportPanel.ts only if the tests turn something up.
Risks: a fake context that drifts from the real one tests fiction — keep the recorder the one hud.test.ts uses, not a second dialect of it. Do not turn this into a rewrite of the panel's look.
Brief that fits: scout — tests and the shape of the repository.
Give
src/client/reportPanel.tsthe test the rest of the HUD has, and let the layout claim it makes be checked instead of eyeballed.src/client/report.tsis tested;reportPanel.ts— the 64 lines that turn those strings into pixels during the round-over delay — is one of only two client modules with no test file beside it. It carries real arithmetic worth pinning:rowscounts the panel's height from the number of lines and the two empty cases,MAX_LINEScaps at five,wclamps towidth - 24on a narrow screen, and the whole thing draws nothing unlessworld.match.phase === "over".hud.test.ts:20already has arecorder()that hands back a fake 2D context and the list of calls it received, which is all this needs.Done looks like:
src/client/reportPanel.test.tsexists and drivesdrawReportthrough a recording context; the recorder is shared rather than copied — liftrecorder()into a small test helper both files import, or export it from one, whichever keepshud.test.tsunchanged in behaviour.freeze,liveorplanted; the panel appears inover; a round with no damage either way draws "nothing" twice; six opponents hit draws five lines, not six; the panel's width never exceeds the canvas at 360px; the total line reads whatreport()says.reportPanel.tsunless a test finds a real bug — if it does, fix the code and say so in the pull.bun run checkgreen.Files I expect to change: new
src/client/reportPanel.test.ts, a shared recorder (src/client/hud.test.tsor a newsrc/client/recorder.test-helper.ts— match whatever the repo does elsewhere), andsrc/client/reportPanel.tsonly if the tests turn something up.Risks: a fake context that drifts from the real one tests fiction — keep the recorder the one
hud.test.tsuses, not a second dialect of it. Do not turn this into a rewrite of the panel's look.Brief that fits: scout — tests and the shape of the repository.