25 lines
1.1 KiB
Python
25 lines
1.1 KiB
Python
from pathlib import Path
|
|
|
|
APP_JS = (Path(__file__).resolve().parents[1] / "ui_builder" / "static" / "app.js").read_text(encoding="utf-8")
|
|
|
|
|
|
def test_ready_penalty_opens_target_when_scoreboard_is_live():
|
|
start = APP_JS.index("async function rebalanceVmixPenaltyTargets")
|
|
end = APP_JS.index("function finishActionMatchesSource", start)
|
|
snippet = APP_JS[start:end]
|
|
assert "if (hockeyScoreboardIsLive())" in snippet
|
|
assert 'commands.push({ Function: `OverlayInput${overlay}In`, Input: target.input });' in snippet
|
|
|
|
|
|
def test_penalty_overlay_auto_in_does_not_retrigger_visible_target():
|
|
start = APP_JS.index("async function rebalanceVmixPenaltyTargets")
|
|
end = APP_JS.index("function finishActionMatchesSource", start)
|
|
snippet = APP_JS[start:end]
|
|
assert "const targetWasVisible = Boolean(previous?.input)" in snippet
|
|
assert "if (!targetWasVisible)" in snippet
|
|
|
|
|
|
def test_existing_team_state_sync_logic_is_untouched():
|
|
assert 'for (const key of ["home_delayed_penalty", "home_empty_net", "away_delayed_penalty", "away_empty_net"])' in APP_JS
|
|
assert "async function hockeySyncTeamStateOverlays" in APP_JS
|