Testing
Health Tracker uses two testing layers: unit tests for database queries and Playwright for end-to-end testing.
Unit tests
Server-side query tests live in src/server/queries/daily_logs.rs and use an in-memory SQLite database. They cover:
- Upsert (insert and update) operations
- Date-based retrieval
- Month summary generation
- Delete operations
Run with:
cargo test
E2E tests
End-to-end tests live in the end2end/tests/ directory and use Playwright to interact with the running application.
# Run E2E tests
just test
# Run E2E tests in release mode
just test-release
CI integration
Both unit tests and E2E tests run automatically in the Woodpecker CI pipeline. The pipeline order:
- lint —
cargo fmt --check,leptosfmt --check,cargo clippy -- -D warnings - test —
cargo test(unit tests) - build —
cargo leptos build --release