Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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:

  1. lintcargo fmt --check, leptosfmt --check, cargo clippy -- -D warnings
  2. testcargo test (unit tests)
  3. buildcargo leptos build --release