Files
hockey_new/tests/test_build105_suspend_countdown_pause.py
2026-08-24 16:39:58 +03:00

35 lines
1.4 KiB
Python

from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
APP_JS = (ROOT / "ui_builder/static/app.js").read_text(encoding="utf-8")
APP = (ROOT / "app.py").read_text(encoding="utf-8")
def _block(start: str, end: str) -> str:
return APP_JS.split(start, 1)[1].split(end, 1)[0]
def test_space_pause_uses_suspend_not_stop_reset():
helper = _block("function vmixCountdownSyncCommands", "function buildShortcutRuntimeContext")
branch = helper.split('if (action === "stop" || action === "pause")', 1)[1].split('if (action === "set")', 1)[0]
assert 'Function: "SuspendCountdown"' in branch
assert 'Function: "StopCountdown"' not in branch
assert 'Function: "SetCountdown"' not in branch
def test_explicit_reset_set_path_keeps_stop_then_set():
helper = _block("function vmixCountdownSyncCommands", "function buildShortcutRuntimeContext")
set_branch = helper.split('if (action === "set")', 1)[1].split('return [', 2)[1]
assert 'Function: "StopCountdown"' in set_branch
assert 'Function: "SetCountdown"' in set_branch
def test_penalty_normal_pause_uses_suspend():
block = _block("async function rebalanceVmixPenaltyTargets", "function finishActionMatchesSource")
assert 'if (preservePausedCountdown && !assignmentChanged)' in block
assert 'stopCommands.push({ Function: "SuspendCountdown"' in block
def test_build105_runtime_version():
assert 'BUILD_VERSION = "2026.08.24.8"' in APP