- 12 page smoke tests: homepage (empty/with data/stats), login,
auth-gated redirects (check-in, add, account), authenticated page
loads, logout, and scan redirect
- 5 check-in API tests: existing cafe, new cafe creation, auth,
and validation
- 7 scan API tests: roaster+roast creation, slug-based reuse, bag
creation with timeline event, auth, and field validation
- 9 AI extraction tests: all 3 extract endpoints with wiremock-mocked
OpenRouter, both JSON and Datastar signal responses, auth and
empty input validation
- Test CRUD operations: create, list, get, update, delete
- Test auth requirement, optional fields, enriched data
- Test validation: no changes returns 400, nonexistent returns 404
- Update test helpers with cup_repo wiring
Add 14 server API tests, 6 CLI tests, 4 Datastar fragment tests,
1 timeline event test, and backup round-trip verification. Wire
cafe_repo into test helpers.
- Add BackupData struct and BackupService with raw SQL export/import
- Restore uses raw inserts to bypass brew deductions and timeline creation
- Restore requires an empty database, inserts in FK dependency order
- Add comprehensive e2e test verifying full round-trip fidelity
- Test create, list, get, delete operations
- Test bag deduction and conflict on insufficient coffee
- Test CLI commands with defaults
- Add create_default_gear helper
Implement complete test coverage for the Gear entity across CLI, API,
timeline, and Datastar integration layers. This completes the Gear
entity implementation with 32 dedicated tests ensuring all CRUD
operations, authentication requirements, and reactive UI updates work
correctly.
Test Coverage:
- CLI commands (11 tests): Authentication, CRUD operations, category
filtering, notes handling
- API endpoints (13 tests): HTTP status codes, validation, auth
requirements, filtering
- Timeline integration (1 test): Gear creation events appear correctly
- Datastar fragments (7 tests): Fragment rendering vs full page/JSON
responses for list, create, update, delete
Changes:
- Add tests/cli/gear_cli.rs with CLI integration tests
- Add tests/server/gear_api.rs with API integration tests
- Update tests/server/timeline.rs with gear timeline test
- Update tests/server/datastar.rs with gear fragment rendering tests
- Register test modules in tests/cli/main.rs and tests/server/main.rs
- Clean up unused imports in tests/server/helpers.rs
All 140 tests pass (8 unit + 37 CLI + 95 server integration).
Rename roasters.rs to roasters_api.rs and roasts.rs to roasts_api.rs
to make it clear these files only test the /api/v1 endpoints, not the
page endpoints.
Co-authored-by: jnsgruk <668505+jnsgruk@users.noreply.github.com>
Move tests/server.rs to tests/server/main.rs and update module
paths to make the server tests more self-contained. All test
imports now use crate::helpers instead of crate::server::helpers.
Co-authored-by: jnsgruk <668505+jnsgruk@users.noreply.github.com>