🧩 Background
When the database connection is interrupted or in a non-active state, model operations must behave cleanly.
🎯 Objective
Verify user model and schema behavior under database connection state 0 (disconnected).
📁 Files to touch
lib/mongodb.test.ts
models/User.test.ts
🛠️ Implementation steps
- Mock mongoose connection states using database stubs.
- Verify that database operations queries fail gracefully with a descriptive ConnectionError.
✅ Definition of done
🧩 Background
When the database connection is interrupted or in a non-active state, model operations must behave cleanly.
🎯 Objective
Verify user model and schema behavior under database connection state 0 (disconnected).
📁 Files to touch
lib/mongodb.test.tsmodels/User.test.ts🛠️ Implementation steps
✅ Definition of done