tractatus/tests/helpers
TheFlow b9be0fb3b6 feat(tests): create database test helper and diagnose integration test issues
PROBLEM: 10/26 integration test suites hanging (API tests)
- Tests import app but don't connect required databases
- Tractatus uses TWO separate DB connections (native + Mongoose)
- Tests only connected one, causing hangs when routes accessed User model

INVESTIGATION:
- Created minimal.test.js - diagnostic test (passes)
- Identified root cause: dual database architecture
- Updated api.auth.test.js with both connections (still investigating hang)

CREATED:
- tests/helpers/db-test-helper.js - Unified database setup helper
  Exports setupDatabases() and cleanupDatabases()
  Connects both native MongoDB driver AND Mongoose
  Ready for use in all integration tests

PARTIAL FIX:
- tests/integration/api.auth.test.js - Updated to connect both DBs
- Still investigating why tests hang (likely response field mismatch)

NEXT SESSION:
1. Apply db-test-helper to all 7 API integration tests
2. Fix response field mismatches (accessToken vs token)
3. Verify all tests pass

IMPACT: Test helper provides pattern for fixing all integration tests

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-21 15:39:27 +13:00
..
cleanup.js fix: add Jest test infrastructure and reduce test failures from 29 to 13 2025-10-09 20:37:45 +13:00
db-test-helper.js feat(tests): create database test helper and diagnose integration test issues 2025-10-21 15:39:27 +13:00