
The application entry point main() in game.js has zero test coverage. Its fetch-error fallback, global event listeners, and module initialization orchestration are all untested.
Context
game.test.js covers setupCorp and setupRunner but stops there. The main() function (lines 52–87) is the actual entry point imported by index.html. It fetches the card database, handles fetch failure by rendering an error message, registers three global event listeners (middle-click prevention, context menu dismissal, auxclick dismissal), and calls setupKeyboardShortcuts, setupP2P, setupSidePanels, and setupTokenSpawning. None of these behaviors have any test coverage. A fetch failure in production silently renders a <p> tag and returns — if that rendering ever breaks, no test will catch it. The module initialization order is also load-bearing (e.g., setupP2P queries DOM elements created by index.html) and deserves at least a smoke-level integration test.
Affected Files
src/scripts/game.test.js — Add a describe("main") block with tests for the fetch-error path and the success path
src/scripts/game.js:52 — The main() function under test — no changes needed to the source
Requirements

Verification
- npm test -- --reporter=verbose src/scripts/game.test.js
- npm test
Not In Scope
- Do not refactor
main() — test the existing behavior as-is.
- Do not add tests for
setupP2P internals — those belong in p2p.test.js.
- Do not test the
window.addEventListener('load', ...) wrapper in index.html.
Evidence
src/scripts/game.test.js — File contains describe blocks for setupCorp and setupRunner only — no mention of main
src/scripts/game.js:52-67 — main() catches fetch errors and renders a #fetch-error paragraph — untested path
src/scripts/game.js:69-86 — main() registers three global event listeners and calls four setup functions — none covered by any test
Arasaka Queue Planning Division.

The application entry point
main()ingame.jshas zero test coverage. Its fetch-error fallback, global event listeners, and module initialization orchestration are all untested.Context
game.test.jscoverssetupCorpandsetupRunnerbut stops there. Themain()function (lines 52–87) is the actual entry point imported byindex.html. It fetches the card database, handles fetch failure by rendering an error message, registers three global event listeners (middle-click prevention, context menu dismissal, auxclick dismissal), and callssetupKeyboardShortcuts,setupP2P,setupSidePanels, andsetupTokenSpawning. None of these behaviors have any test coverage. A fetch failure in production silently renders a<p>tag and returns — if that rendering ever breaks, no test will catch it. The module initialization order is also load-bearing (e.g.,setupP2Pqueries DOM elements created byindex.html) and deserves at least a smoke-level integration test.Affected Files
src/scripts/game.test.js— Add adescribe("main")block with tests for the fetch-error path and the success pathsrc/scripts/game.js:52— Themain()function under test — no changes needed to the sourceRequirements
fetchAllCardsrejects,main()appends a#fetch-errorelement with the expected message text and returns without callingsetupP2Por other initialization functions.fetchAllCardsresolves,main()populateswindow.allCardsand callssetupKeyboardShortcuts,setupP2P,setupSidePanels, andsetupTokenSpawning.main()maps each card entry to include animageURL derived fromcard.code.Verification
Not In Scope
main()— test the existing behavior as-is.setupP2Pinternals — those belong inp2p.test.js.window.addEventListener('load', ...)wrapper inindex.html.Evidence
src/scripts/game.test.js— File containsdescribeblocks forsetupCorpandsetupRunneronly — no mention ofmainsrc/scripts/game.js:52-67—main()catches fetch errors and renders a#fetch-errorparagraph — untested pathsrc/scripts/game.js:69-86—main()registers three global event listeners and calls four setup functions — none covered by any testArasaka Queue Planning Division.