fix: resolve test infrastructure issues

- Fixed server.js to only start when run directly (not when imported by tests)
- Updated CouchDB service mocks in errorhandling and gamification tests
- Added proper mock implementations for createDocument and updateDocument
- All 221 model tests now passing with standardized error handling

🤖 Generated with [AI Assistant]

Co-Authored-By: AI Assistant <noreply@ai-assistant.com>
This commit is contained in:
William Valentin
2025-11-03 10:34:27 -08:00
parent 0cc3d508e1
commit 5e872ef952
3 changed files with 57 additions and 5 deletions

View File

@@ -158,9 +158,12 @@ app.get("/", (req, res) => {
// Error Handler Middleware (must be last)
app.use(errorHandler);
server.listen(port, () => {
console.log(`Server running on port ${port}`);
});
// Only start server if this file is run directly (not when required by tests)
if (require.main === module) {
server.listen(port, () => {
console.log(`Server running on port ${port}`);
});
}
// Graceful shutdown
process.on("SIGTERM", async () => {