тест 8

This commit is contained in:
2026-08-24 18:17:26 +03:00
parent 65a2521156
commit aac9e5b8bc
7 changed files with 170 additions and 38 deletions

View File

@@ -30,7 +30,7 @@ def test_visible_match_card_opens_from_schedule_without_details_roundtrip() -> N
assert "state.selectedGame = scheduleGame;" in TOURNAMENT_JS
assert "Opening the workspace must be immediate" in TOURNAMENT_JS
# Full details remain optional enrichment after the match is selected.
assert "void enrichOpenedGame(String(id), state.selectedId, generation);" in TOURNAMENT_JS
assert "enrichOpenedGame(String(id), state.selectedId, generation, { opening: true })" in TOURNAMENT_JS
def test_browser_timeout_no_longer_blames_stat2tv_for_every_endpoint() -> None:

View File

@@ -0,0 +1,52 @@
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
JS = (ROOT / "hockey_data" / "static" / "tournament-menu.js").read_text(encoding="utf-8")
SERVICE = (ROOT / "hockey_data" / "service.py").read_text(encoding="utf-8")
ROUTER = (ROOT / "hockey_data" / "router.py").read_text(encoding="utf-8")
APP = (ROOT / "app.py").read_text(encoding="utf-8")
def test_previous_match_runtime_rosters_are_explicitly_cleared():
assert "function clearRuntimeMatchSpecificData()" in JS
assert "selected_game: null" in JS
assert "home: null" in JS
assert "away: null" in JS
assert "referees: []" in JS
assert "match_details: null" in JS
assert "clearRuntimeMatchSpecificData();" in JS
def test_old_polling_stops_before_new_match_selection():
start = JS.index("async function openGame")
stop = JS.index("stopSelectedGamePolling();", start)
generation = JS.index("const generation = ++state.gameOpenGeneration;", start)
assert stop < generation
def test_selected_game_cache_is_match_scoped_and_local():
assert "/api/hockey/games/${encodeURIComponent(id)}/details?language=" in JS
assert "cachedMatchHasRosters" in JS
assert "cachedRostersReady" in JS
def test_first_time_match_waits_for_core_roster_before_polling():
assert "if (!manual && !cachedRostersReady)" in JS
assert "await enrichOpenedGame(String(id), state.selectedId, generation, { opening: true });" in JS
branch = JS.index("if (!manual && !cachedRostersReady)")
enrich = JS.index("await enrichOpenedGame", branch)
poll = JS.index("startSelectedGamePolling();", enrich)
assert enrich < poll
def test_opening_sync_skips_schedule_roundtrip_and_optional_shots():
assert "opening: bool = False" in ROUTER
assert "opening=opening" in ROUTER
assert "if opening:" in SERVICE
assert "schedule = self.game(game_external_id, language=language)" in SERVICE
assert "skip_optional_shots=opening" in SERVICE
assert "if not skip_optional_shots:" in SERVICE
def test_runtime_version_build110():
assert 'BUILD_VERSION = "2026.08.24.13"' in APP

View File

@@ -17,7 +17,7 @@ def test_runtime_is_default_even_for_legacy_editor_bookmarks():
def test_match_selection_no_longer_depends_on_full_details_sync():
assert 'Match selection itself depends only on the local/cached schedule row.' in TOURNAMENT_JS
assert 'void enrichOpenedGame(String(id), state.selectedId, generation);' in TOURNAMENT_JS
assert 'enrichOpenedGame(String(id), state.selectedId, generation, { opening: true })' in TOURNAMENT_JS
assert 'Full match JSON, rosters, shots and directories are enrichment data.' in TOURNAMENT_JS
assert 'gameOpenGeneration' in TOURNAMENT_JS