feat: add replay server and web client

This commit is contained in:
qianrui.mmmy
2026-05-13 16:48:00 +08:00
parent 09c42e9fa3
commit 3c027eae0b
8 changed files with 1967 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
from __future__ import annotations
import unittest
from texas_holdem_replay.server import build_game_url
class ReplayServerTests(unittest.TestCase):
def test_build_game_url_from_base_and_game_id(self) -> None:
self.assertEqual(
build_game_url({"base_url": ["http://127.0.0.1:8000/"], "game_id": ["game 1"]}),
"http://127.0.0.1:8000/games/game%201",
)
def test_build_game_url_accepts_full_url(self) -> None:
self.assertEqual(
build_game_url({"url": ["https://example.test/games/demo"]}),
"https://example.test/games/demo",
)
def test_build_game_url_rejects_non_http_url(self) -> None:
with self.assertRaises(ValueError):
build_game_url({"url": ["file:///tmp/game.json"]})
if __name__ == "__main__":
unittest.main()