Repair the tooltip tests left behind by two refactors #326

Merged
nelsong6 merged 1 commit from claude/repair-stale-tooltip-tests into main 2026-09-09 15:47:04 -07:00
nelsong6 commented 2026-09-09 15:22:30 -07:00 (Migrated from github.com)

Why

main's test job has been red since around #309 (Aug 8) — 14 failing cases, none of them a product bug. Two refactors landed correctly; their tests weren't carried forward.

Cause 1 — nine tests died at class load

They reflected on per-power methods (AppendAggressionPowerStats, …) that #309 deleted when it folded them into two shared renderers. They threw TypeInitializationException before reaching any assertion.

They now go through the renderers the game actually uses:

  • AppendCanonicalMetaPowerStats — the full view a shared meta-power record shows
  • AppendMetaPowerLifetimeStats(detailed: false) — the compact rows a physical Power card shows

Resolving a card to its definition needs the game's model db, so that step stays covered by MetaPowerRegistry's own tests rather than being faked with an uninitialized card.

Ids now come from the registry instead of hand-written "POWER.X" constants — which is the bug #309 itself fixed: ids derive from the game's types, so a copied constant stops matching the moment a type is renamed.

Cause 2 — every average computed as zero

The averages moved onto dedicated Rate* numerators over shared Meta* turn denominators. The fixtures set neither, so each ratio divided by zero. They now populate both halves, chosen so the expected value in each test still means what it meant before — 18 strength over 6 active turns is still 3.

Cause 3 — reworded and icon-ised labels

Avg triggers per turn once active → Avg triggers / active turn; Orbs created → an orb icon followed by created. Those assert on the row's [hint], which preserves the original wording.

Three assertions dropped, deliberately

The rows they pinned no longer exist:

  • per-combat averages for Danse Macabre, Dark Embrace and Juggling — replaced by per-active-application-turn
  • Entropy's compact view now leads with the power's primary outcome rather than its chain-break count, so that test asserts the current contract and is renamed to match

Flagging these explicitly: they're the only places where behaviour, not just naming, changed. If any was an unintended loss in #309, this PR pins the current behaviour and the fix belongs in Core, not here.

Verification

2128 passed, 0 failed, against a captured baseline of 12 failing tests on unmodified main. Diffed the failure sets at each step to confirm no new failures were introduced along the way.

Tests only — no Core changes.

🤖 Generated with Claude Code

## Why `main`'s test job has been red since around #309 (Aug 8) — **14 failing cases, none of them a product bug**. Two refactors landed correctly; their tests weren't carried forward. ## Cause 1 — nine tests died at class load They reflected on per-power methods (`AppendAggressionPowerStats`, …) that #309 deleted when it folded them into two shared renderers. They threw `TypeInitializationException` before reaching any assertion. They now go through the renderers the game actually uses: - `AppendCanonicalMetaPowerStats` — the full view a shared meta-power record shows - `AppendMetaPowerLifetimeStats(detailed: false)` — the compact rows a physical Power card shows Resolving a *card* to its definition needs the game's model db, so that step stays covered by `MetaPowerRegistry`'s own tests rather than being faked with an uninitialized card. Ids now come from the registry instead of hand-written `"POWER.X"` constants — which is the bug #309 itself fixed: ids derive from the game's types, so a copied constant stops matching the moment a type is renamed. ## Cause 2 — every average computed as zero The averages moved onto dedicated `Rate*` numerators over shared `Meta*` turn denominators. The fixtures set neither, so each ratio divided by zero. They now populate both halves, **chosen so the expected value in each test still means what it meant before** — 18 strength over 6 active turns is still 3. ## Cause 3 — reworded and icon-ised labels `Avg triggers per turn once active` → `Avg triggers / active turn`; `Orbs created` → an orb icon followed by `created`. Those assert on the row's `[hint]`, which preserves the original wording. ## Three assertions dropped, deliberately The rows they pinned no longer exist: - per-combat averages for Danse Macabre, Dark Embrace and Juggling — replaced by per-active-application-turn - Entropy's compact view now leads with the power's primary outcome rather than its chain-break count, so that test asserts the current contract and is renamed to match Flagging these explicitly: they're the only places where behaviour, not just naming, changed. If any was an unintended loss in #309, this PR pins the current behaviour and the fix belongs in `Core`, not here. ## Verification `2128 passed, 0 failed`, against a captured baseline of 12 failing tests on unmodified `main`. Diffed the failure sets at each step to confirm no new failures were introduced along the way. Tests only — no `Core` changes. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
romaine-life/spirelens!326
No description provided.