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:
@@ -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 () => {
|
||||
|
||||
Reference in New Issue
Block a user