Skip to content

test: smoke-test-career — full 3-season engine end-to-end - #19

Open
wpinrui wants to merge 1 commit into
mainfrom
smoke-test-career
Open

test: smoke-test-career — full 3-season engine end-to-end#19
wpinrui wants to merge 1 commit into
mainfrom
smoke-test-career

Conversation

@wpinrui

@wpinrui wpinrui commented Mar 20, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds scripts/smoke-test-career.ts: a standalone Node.js script that drives a full 3-season career through the real Zustand store with no UI
  • Polyfills localStorage so the persist middleware doesn't block execution in Node
  • Uses simulateAIShot for the player's shots (testing the pipeline, not player skill)
  • 369 assertions, all passing

What is tested

startCareer: roster = 50, country codes unique, shakiness/age/phase correct

Per-event (15 events total):

  • Player and all 49 competitors have exactly 10 arrow scores
  • All scores in [0, 10], no NaN
  • Results: exactly 50 entries, positions 1–50 no gaps, medals to top 3 only, points match GDD table, total per event = 745

Per-season (3 seasons):

  • Championship position matches pre-completion standings
  • Shakiness only decreases (player < 30, no aging penalty)
  • Player age increments correctly
  • Still exactly 49 competitors, 50 unique country codes, all original nations present
  • Exactly 5 rookies replace the 5 lowest-skill (post-aging) competitors; rookies aged 18–25

retire: 5 highlight slides max, last is championship; career history = 3 rows; phase = 'retired'

resetCareer: state fully wiped back to initial values

Bug discovered during development

The script initially pre-computed the "retiring 5" from the un-aged roster. But completeSeason ages all competitors first, then retires the bottom 5 of the aged roster — which can be a different set. Fixed by replicating the aging step via ageCompetitor before identifying which codes will be replaced.

Also

Opened issue #18 for pre-existing yarn lint errors in ShootingHUD (found during this task, pre-date this PR).

Usage

npx tsx scripts/smoke-test-career.ts 2>/dev/null

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