Added unit tests for pure logic. Refs #2

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-10 17:01:51 +02:00
co-authored by Claude Opus 5.5
parent 5dbe7c36b1
commit 2babe19299
7 changed files with 689 additions and 5 deletions
+5 -2
View File
@@ -16,11 +16,14 @@ cargo leptos watch # dev server with reload (needs config.toml +
cargo leptos build --release # production build -> target/release/rezervator + target/site
cargo check --features ssr # type-check the server side
cargo check --lib --features hydrate --target wasm32-unknown-unknown # type-check the WASM side
cargo test --features ssr # unit tests
```
Run both `cargo check` commands after any change; a plain `cargo check` (no features) checks neither side properly.
Run both `cargo check` commands and the tests after any change; a plain `cargo check` / `cargo test` (no features) checks neither side properly.
There are no unit tests, and `end2end/` is still the untouched Leptos template (it asserts "Welcome to Leptos") — it does not test this app. Don't claim something is tested because these pass.
Unit tests are `#[cfg(test)] mod tests` at the bottom of the file they test (`#[cfg(all(test, feature = "ssr"))]` for ssr-only code). They cover pure logic only — parsing, validation, paging, slot merging, mail templates, config. Nothing touches the database, so server functions, permissions and SQL are untested. Add tests for new pure logic; keep them free of DB and network.
`end2end/` is still the untouched Leptos template (it asserts "Welcome to Leptos") — it does not test this app.
## Running locally