test(webhost): cover all active lobby states in dashboard aggregation#44
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
TestGetDashboardData.test_all_active_lobby_states_countedtotest/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_LOCKEDfromWebHostLib.modelsand creatingLobbyrows directly, mirroringtest_closed_lobbies_excluded_from_count), then asserts:data.stats.open_lobbies == 4— every active state is counteddata.stats.open_lobbies_sub == "1 open · 1 generating · 1 locked · 1 done"— the exact ordering the source buildsWhy
WebHostLib/dashboard.pyuses_ACTIVE_LOBBY_STATES = (0, 1, 2, 3)to decide which lobbies count as active, and buildsopen_lobbies_subfrom per-state counts (open / generating / locked / done). No existing test created astate=3(LOCKED) lobby, so a mutation dropping3from that tuple — or mishandling thelocked_count/ "N locked" sub-string branch — passed undetected. This closes that gap.Scope
Test-side only — no product code changed.
Verification
🤖 Generated with Claude Code