summaryrefslogtreecommitdiffstats
path: root/docs/TESTING.md
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-10-28 22:46:47 +0100
committersalmonik <salmonik@tuta.io>2026-10-28 22:46:47 +0100
commit47d6c82a4943b1e804d062780b8e05f1e42f27b0 (patch)
tree11d0d557025118c7deb021eb9ad425fcc8b1e918 /docs/TESTING.md
parentv0.3.0: add server core, bcrypt migration and plays audit (diff)
downloadzagan-bet-47d6c82a4943b1e804d062780b8e05f1e42f27b0.tar.gz
zagan-bet-47d6c82a4943b1e804d062780b8e05f1e42f27b0.zip
v0.3.1: clean up dependencies, stale tests and document verification
Diffstat (limited to '')
-rw-r--r--docs/TESTING.md52
1 files changed, 52 insertions, 0 deletions
diff --git a/docs/TESTING.md b/docs/TESTING.md
new file mode 100644
index 0000000..6cac6fa
--- /dev/null
+++ b/docs/TESTING.md
@@ -0,0 +1,52 @@
1# Testing
2
3## Automated suite
4
5```sh
6cargo test
7```
8
9The suite is deterministic and headless: no network, no PTY, no sleeps, no
10shared global database. Each test owns its state.
11
12| File | Covers |
13| --- | --- |
14| `tests/client_core.rs` | Client command/game flows via a headless screen applying logical effects. |
15| `tests/client_ui.rs` | Help, history, completion, bet parsing, display width, cursor math. |
16| `tests/protocol.rs` | Newline buffering and timeout/error classification. |
17| `tests/server_core.rs` | Handler, bcrypt migration, SQL injection, transaction rollback, `plays` audit, sessions. |
18| `tests/slots.rs` | Server slots payout rules and overflow handling. |
19| `tests/storage.rs` | Client/server SQLite storage helpers. |
20| `tests/tofu.rs` | SPKI fingerprint and TOFU decisions. |
21
22`tests/tofu.rs` shells out to `openssl`, so run it on a machine where the
23`openssl` CLI is available.
24
25## Manual TUI checklist
26
27There is no CI. Run this on Linux and on a Windows VM before a release.
28Use an 80-column terminal because several output lines are width-sensitive.
29
301. Start the server with a valid `identity.p12`, then start the client.
312. First contact prints three lines and the 64-character fingerprint does not
32 wrap at 80 columns. `Connected to ...` shows a one-decimal ping.
333. `register` / `login`: backspace removes one `*` per key, Esc cancels the
34 prompt, Ctrl+C exits and restores the terminal.
354. `help` fits 80 columns. Tab completion wraps within 76 columns and the
36 cursor stays visible.
375. `play slots 50` shows `Bet: 50 PLN` and the fetched balance.
386. Space shows `Spinning...`, then the reels, win text, and new balance inside
39 the same 7-line board. The controls line is never overwritten.
407. `+` / `-` after a spin changes only the bet; no stale result lines appear.
418. `q` clears the board. Ctrl+C in a game clears the board and exits.
429. `info`, `ping`, `send hello`, and `hosts` print readable output; the host
43 fingerprint fits 80 columns.
4410. Windows: repeat 2-9 and confirm keys are not duplicated or printed twice.
45
46## Manual server checks
47
48- Register, log out, log in again (bcrypt path).
49- Log in with a pre-0.3 user row (legacy SHA-256) and confirm it still works;
50 the row is upgraded to bcrypt.
51- Spin several times and confirm `plays` grows by one row per spin while
52 `users.balance` changes by `winnings - bet`.