Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c59dca754f |
@@ -18,9 +18,9 @@ docker-compose up --build
|
|||||||
docker-compose down -v # also drops the pg volume — needed after a schema change
|
docker-compose down -v # also drops the pg volume — needed after a schema change
|
||||||
|
|
||||||
# Tests
|
# Tests
|
||||||
python -m unittest tests -v # pure-engine unittest (no deps)
|
python -m unittest tests.test_engine -v # pure-engine unittest (no deps)
|
||||||
python -m unittest tests_history -v # persistence + auth (needs sqlalchemy/aiosqlite/pyotp)
|
python -m unittest tests.test_history -v # persistence + auth (needs sqlalchemy/aiosqlite/pyotp)
|
||||||
python -m unittest tests.StashCase.test_get_winner # single method
|
python -m unittest tests.test_engine.StashCase.test_get_winner # single method
|
||||||
```
|
```
|
||||||
|
|
||||||
There is no linter or build step configured. The frontend is **only ever run via Docker** — never `npm install`/`npm run dev` on the host.
|
There is no linter or build step configured. The frontend is **only ever run via Docker** — never `npm install`/`npm run dev` on the host.
|
||||||
@@ -31,7 +31,7 @@ Three independent layers, each usable without the one above it: **engine** (`bri
|
|||||||
|
|
||||||
### Game engine — `bridzik.py`
|
### Game engine — `bridzik.py`
|
||||||
|
|
||||||
Pure Python, **no Flask/Socket.IO/DB dependency**. All game rules live here and are exercised directly by `tests.py`. State is a strict nested hierarchy, each level enforcing turn order and completion before delegating down:
|
Pure Python, **no Flask/Socket.IO/DB dependency**. All game rules live here and are exercised directly by `tests/test_engine.py`. State is a strict nested hierarchy, each level enforcing turn order and completion before delegating down:
|
||||||
|
|
||||||
- **`Bridzik`** — a whole game = exactly **4 `Series`**.
|
- **`Bridzik`** — a whole game = exactly **4 `Series`**.
|
||||||
- **`Series`** — exactly **8 `Round`s**; the starting player rotates per series/round.
|
- **`Series`** — exactly **8 `Round`s**; the starting player rotates per series/round.
|
||||||
@@ -75,6 +75,6 @@ React + Vite PWA (zustand store, react-router, socket.io-client, `qrcode.react`)
|
|||||||
|
|
||||||
## Conventions
|
## Conventions
|
||||||
|
|
||||||
- New game-rule logic belongs in `bridzik.py` with a `unittest` case in `tests.py` — keep the engine free of Flask/Socket.IO/DB.
|
- New game-rule logic belongs in `bridzik.py` with a `unittest` case in `tests/test_engine.py` — keep the engine free of Flask/Socket.IO/DB.
|
||||||
- Persistence/auth logic goes in `db/` (data primitives) and `api/history.py` + `api/auth.py` (logic that uses them); cover it in `tests_history.py`, not `tests.py`.
|
- Persistence/auth logic goes in `db/` (data primitives) and `api/history.py` + `api/auth.py` (logic that uses them); cover it in `tests/test_history.py`, not `tests/test_engine.py`.
|
||||||
- Raise `BridzikException` (Slovak message) for rule violations; the API catches it and re-emits a Slovak error. Auth errors use `AuthError` the same way.
|
- Raise `BridzikException` (Slovak message) for rule violations; the API catches it and re-emits a Slovak error. Auth errors use `AuthError` the same way.
|
||||||
|
|||||||
Reference in New Issue
Block a user