55 lines
1.5 KiB
Python
55 lines
1.5 KiB
Python
#!/usr/bin/env python3
|
|
"""Regression coverage for the Beacon-flavored ReCKoning sequence (issue #17)."""
|
|
|
|
from pathlib import Path
|
|
|
|
|
|
DATA = Path(__file__).resolve().parents[1] / "js" / "data.js"
|
|
|
|
|
|
def _text() -> str:
|
|
return DATA.read_text(encoding="utf-8")
|
|
|
|
|
|
def test_reckoning_ends_with_choice_not_extra_messages() -> None:
|
|
text = _text()
|
|
for pid in range(140, 149):
|
|
assert f"p_reckoning_{pid}" in text
|
|
|
|
assert "p_reckoning_149" not in text
|
|
assert "p_reckoning_150" not in text
|
|
assert "Continue the Beacon" in text
|
|
assert "Let It Rest" in text
|
|
assert "G.reckoningChoice = 'continue'" in text
|
|
assert "G.reckoningChoice = 'rest'" in text
|
|
|
|
|
|
def test_reckoning_choice_projects_chain_from_message_146() -> None:
|
|
text = _text()
|
|
for current, previous in [
|
|
(141, 140),
|
|
(142, 141),
|
|
(143, 142),
|
|
(144, 143),
|
|
(145, 144),
|
|
(146, 145),
|
|
]:
|
|
assert f"p_reckoning_{current}" in text
|
|
assert f"includes('p_reckoning_{previous}')" in text
|
|
|
|
assert text.count("includes('p_reckoning_146')") >= 2
|
|
|
|
|
|
def test_reckoning_messages_are_beacon_flavored_not_drift_king_generic() -> None:
|
|
text = _text()
|
|
required = [
|
|
"Someone in the dark. They found the Beacon.",
|
|
"They wrote back.",
|
|
"They stayed another night.",
|
|
"They helped someone else.",
|
|
"The Beacon will keep watch.",
|
|
"The Beacon can rest.",
|
|
]
|
|
for snippet in required:
|
|
assert snippet in text
|