Skip to content

test(webhost): cover all active lobby states in dashboard aggregation#44

Merged
lallaria merged 1 commit into
mainfrom
test/dashboard-active-lobby-states
Jun 5, 2026
Merged

test(webhost): cover all active lobby states in dashboard aggregation#44
lallaria merged 1 commit into
mainfrom
test/dashboard-active-lobby-states

Conversation

@lallaria

@lallaria lallaria commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

What

Adds TestGetDashboardData.test_all_active_lobby_states_counted to test/webhost/test_dashboard.py, covering the dashboard aggregation's handling of all four "active" lobby states.

The test builds one lobby in each active state — OPEN(0), GENERATING(1), DONE(2), LOCKED(3) — for a single session (importing LOBBY_OPEN / LOBBY_GENERATING / LOBBY_DONE / LOBBY_LOCKED from WebHostLib.models and creating Lobby rows directly, mirroring test_closed_lobbies_excluded_from_count), then asserts:

  • data.stats.open_lobbies == 4 — every active state is counted
  • data.stats.open_lobbies_sub == "1 open · 1 generating · 1 locked · 1 done" — the exact ordering the source builds

Why

WebHostLib/dashboard.py uses _ACTIVE_LOBBY_STATES = (0, 1, 2, 3) to decide which lobbies count as active, and builds open_lobbies_sub from per-state counts (open / generating / locked / done). No existing test created a state=3 (LOCKED) lobby, so a mutation dropping 3 from that tuple — or mishandling the locked_count / "N locked" sub-string branch — passed undetected. This closes that gap.

Scope

Test-side only — no product code changed.

Verification

.venv/Scripts/python.exe -m pytest test/webhost/test_dashboard.py -p no:xdist -q
# 10 passed

🤖 Generated with Claude Code

Add TestGetDashboardData.test_all_active_lobby_states_counted, which builds OPEN/GENERATING/DONE/LOCKED lobbies for one session and asserts open_lobbies == 4 plus the exact open_lobbies_sub ordering. Closes the mutation gap where dropping LOCKED(3) from _ACTIVE_LOBBY_STATES, or mishandling the locked_count sub-string branch, passed undetected (no test created a state=3 lobby). Test-side only; no product code changed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@lallaria lallaria merged commit dd939ab into main Jun 5, 2026
17 of 19 checks passed
@lallaria lallaria deleted the test/dashboard-active-lobby-states branch June 5, 2026 01:14
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