43 lines
1.3 KiB
Python
43 lines
1.3 KiB
Python
"""Tests for the /help page. Refs: #833 (Missing /help page)."""
|
|
from pathlib import Path
|
|
|
|
|
|
def test_help_html_exists() -> None:
|
|
assert Path("help.html").exists(), "help.html must exist to resolve /help 404"
|
|
|
|
|
|
def test_help_html_is_valid_html() -> None:
|
|
content = Path("help.html").read_text()
|
|
assert "<!DOCTYPE html>" in content
|
|
assert "<html" in content
|
|
assert "</html>" in content
|
|
|
|
|
|
def test_help_page_has_required_sections() -> None:
|
|
content = Path("help.html").read_text()
|
|
|
|
# Navigation controls section
|
|
assert "Navigation Controls" in content
|
|
|
|
# Chat commands section
|
|
assert "Chat" in content
|
|
|
|
# Portal reference
|
|
assert "Portal" in content
|
|
|
|
# Back link to home
|
|
assert 'href="/"' in content
|
|
|
|
|
|
def test_help_page_links_back_to_home() -> None:
|
|
content = Path("help.html").read_text()
|
|
assert 'href="/"' in content, "help page must have a link back to the main Nexus world"
|
|
|
|
|
|
def test_help_page_has_keyboard_controls() -> None:
|
|
content = Path("help.html").read_text()
|
|
# Movement keys are listed individually as <kbd> elements
|
|
for key in ["<kbd>W</kbd>", "<kbd>A</kbd>", "<kbd>S</kbd>", "<kbd>D</kbd>",
|
|
"Mouse", "Enter", "Esc"]:
|
|
assert key in content, f"help page must document the {key!r} control"
|