The application currently has no unit tests, and end2end/ is still the untouched Leptos template (it asserts "Welcome to Leptos"), so nothing verifies the app's behaviour.
Goal
Add unit tests for the logic that can be tested without a running server or database, and make them runnable with cargo test --features ssr.
validator rules on Company, UserProfile, PwdChange, CrReservation
Other:
is_reserved in src/backend/reservation.rs — slot boundaries (start inclusive, end exclusive)
MailMessage::replace_body_vars in src/backend/mail.rs — #date# and #summary# placeholders
Database::con_string and config parsing in src/config.rs (parse config_sample.toml)
AppError conversions and messages in src/error.rs
Out of scope / follow-up
Server functions that need PostgreSQL (reservation creation, users, permissions) — these need an integration test setup with a test database.
Replacing the template Playwright test in end2end/ with real end-to-end tests.
Done when
cargo test --features ssr runs and passes.
The test command is documented in README.md and CLAUDE.md.
The application currently has no unit tests, and `end2end/` is still the untouched Leptos template (it asserts "Welcome to Leptos"), so nothing verifies the app's behaviour.
## Goal
Add unit tests for the logic that can be tested without a running server or database, and make them runnable with `cargo test --features ssr`.
## Candidates
Pure logic in `src/backend/data.rs`:
- `DayHour::try_from` / `DayHours::try_new` — parsing of `HH:MM - HH:MM` lists, empty input, malformed input
- `DayHours` `Display` — round trip with parsing, including discount
- `WeekHours` validation — `RE_HOURS` regex and `validate_hours` ("to" before "from")
- `TmCheck::from_str` — slot string parsing
- `Reservations::add_slot` — merging of adjacent slots per property
- `Page` / `PagedResponse` — `limit`, `offset`, `is_first`, `is_last`, `total_pages` (including `page_size == 0`)
- `validate_closing_time`, `validate_date`
- `validator` rules on `Company`, `UserProfile`, `PwdChange`, `CrReservation`
Other:
- `is_reserved` in `src/backend/reservation.rs` — slot boundaries (start inclusive, end exclusive)
- `MailMessage::replace_body_vars` in `src/backend/mail.rs` — `#date#` and `#summary#` placeholders
- `Database::con_string` and config parsing in `src/config.rs` (parse `config_sample.toml`)
- `AppError` conversions and messages in `src/error.rs`
## Out of scope / follow-up
- Server functions that need PostgreSQL (reservation creation, users, permissions) — these need an integration test setup with a test database.
- Replacing the template Playwright test in `end2end/` with real end-to-end tests.
## Done when
- `cargo test --features ssr` runs and passes.
- The test command is documented in `README.md` and `CLAUDE.md`.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
The application currently has no unit tests, and
end2end/is still the untouched Leptos template (it asserts "Welcome to Leptos"), so nothing verifies the app's behaviour.Goal
Add unit tests for the logic that can be tested without a running server or database, and make them runnable with
cargo test --features ssr.Candidates
Pure logic in
src/backend/data.rs:DayHour::try_from/DayHours::try_new— parsing ofHH:MM - HH:MMlists, empty input, malformed inputDayHoursDisplay— round trip with parsing, including discountWeekHoursvalidation —RE_HOURSregex andvalidate_hours("to" before "from")TmCheck::from_str— slot string parsingReservations::add_slot— merging of adjacent slots per propertyPage/PagedResponse—limit,offset,is_first,is_last,total_pages(includingpage_size == 0)validate_closing_time,validate_datevalidatorrules onCompany,UserProfile,PwdChange,CrReservationOther:
is_reservedinsrc/backend/reservation.rs— slot boundaries (start inclusive, end exclusive)MailMessage::replace_body_varsinsrc/backend/mail.rs—#date#and#summary#placeholdersDatabase::con_stringand config parsing insrc/config.rs(parseconfig_sample.toml)AppErrorconversions and messages insrc/error.rsOut of scope / follow-up
end2end/with real end-to-end tests.Done when
cargo test --features ssrruns and passes.README.mdandCLAUDE.md.