Skip to content

Feat/livefeed#13

Merged
nhannpl merged 14 commits into
devfrom
feat/livefeed
Jan 15, 2026
Merged

Feat/livefeed#13
nhannpl merged 14 commits into
devfrom
feat/livefeed

Conversation

@nhannpl
Copy link
Copy Markdown
Collaborator

@nhannpl nhannpl commented Jan 15, 2026

Migrate tests from in memory to real database (a separate test mongo db)
Update docs and enpoint docs
Get everything in decent note before leaving

- Created docker-compose.test.yml for isolated test database (MongoDB 6.0 on port 27018)
- Updated conftest.py with dual-mode DB fixture (mock vs real via TEST_MODE env var)
- Migrated 3 livefeed test files to support both modes (22 tests total):
  * test_router_streams.py - Router/SSE endpoint tests
  * test_patient_workflow.py - Patient confirmation flow tests
  * test_caregiver_workflow.py - Caregiver escalation tests
- Added helper functions for dual-mode database operations:
  * get_alert_events() - Query events in both modes
  * get_incidents() - Query incidents in both modes
  * save_incident() - Save incidents in both modes
  * save_to_db() - Generic save for any collection
- All tests pass in both mock (0.5s) and real DB (1.6s) modes
- Zero impact on existing test suite (backward compatible)
- Added DB_MIGRATION_PROGRESS.md to track migration status
- Added dual-mode helpers (save_incident, get_alert_events)
- All 2 tests pass in both mock and real DB modes
- Professional workflow (Dispatcher/EMT) authorization and lifecycle tests now fully migrated
- No migration needed - already using proper async patterns
- All login, signup, and refresh token tests pass
- Total: 47 tests passing across livefeed + auth modules
- Documented all infrastructure changes
- Listed all 47 migrated/verified tests
- Included technical decisions and learnings
- Provided usage instructions and next steps
- Users module: 100% compatible (1 test)
- Caregivers module: 86% compatible (31/36 tests passing)
- Total: 87 tests passing in real DB mode
- 5 caregivers tests need migration work
…ting

- Established Docker-based test database infrastructure
- Implemented dual-mode test fixture with automatic cleanup
- Migrated 222 tests across 8 modules to support real MongoDB
- Verified 100% pass rate in both mock and real DB modes
@nhannpl nhannpl merged commit 7d66cb2 into dev Jan 15, 2026
@nhannpl nhannpl deleted the feat/livefeed branch January 15, 2026 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant