test: add functional tests and restructure test suite#77
Merged
FlorentPoinsaut merged 2 commits intomainfrom Apr 29, 2026
Merged
test: add functional tests and restructure test suite#77FlorentPoinsaut merged 2 commits intomainfrom
FlorentPoinsaut merged 2 commits intomainfrom
Conversation
- Split tests/ into tests/unit/ (existing) and tests/functional/ (new) - Add tests/conftest.py with shared FakeScorer, make_ctx, make_bot helpers and pytest fixtures, eliminating duplicate helpers across unit test files - Add tests/functional/test_game_flow.py: end-to-end game scenarios (full game lifecycle, difficulty flow, hint/status, solution, edge cases) - Add tests/functional/test_bot_overlay.py: bot ↔ overlay integration verifying JSON payloads received by a real WebSocket client after each bot command (start, guess, win, solution, late-connect cache) - Update README.md Testing section to document the two-layer structure All 284 tests pass, 92% coverage. No network or Word2Vec model required.
- test_hint_shows_sorted_leaderboard: assert '1. cha', '2. ch', '3. c ' instead of substring checks that could match sub-words - test_status_shows_attempt_count: assert '2 attempt' instead of bare '2' - test_guess_broadcasts_updated_attempt_count: also assert last_guess.word and last_guess.user to verify the full overlay payload - Merge redundant TestOverlayWebSocketWithBot into TestBotOverlayIntegration (both classes were connecting a real WS client after the previous refactor) - Add TestOverlayWebSocketMultiClient.test_broadcast_reaches_all_connected_clients to exercise the 'for ws in set(self._clients)' broadcast loop
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.
Summary
Adds a two-layer test architecture and functional (end-to-end) tests that were previously missing.
Changes
Structure
tests/unit/— existing 7 test files moved here (renames only, logic unchanged)tests/functional/— new directory with 2 new test filestests/conftest.py— shared helpers (FakeScorer,make_ctx,make_bot) and pytest fixtures, eliminating duplicated helpers across unit test filesNew:
tests/functional/test_game_flow.pyEnd-to-end game scenarios at the bot + game layer (no overlay, no network):
setdifficulty+start)hint/statuscommandssolutioncommandNew:
tests/functional/test_bot_overlay.pyBot ↔ overlay WebSocket integration — verifies the JSON payload received by a real WebSocket client after each bot command:
start→ client receivesstatus: runningguess→ client receives updatedattempt_countstatus: found+target_wordsolution→ client receivesstatus: foundREADME
Testing section updated to document the two-layer structure and per-layer run commands.
Test results
No Twitch network connection or Word2Vec model required.