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

@@ -5,8 +5,14 @@ jest.mock('../services/couchdbService', () => ({
create: jest.fn(),
getById: jest.fn(),
find: jest.fn(),
createDocument: jest.fn(),
updateDocument: jest.fn(),
createDocument: jest.fn().mockImplementation((doc) => ({
...doc,
_rev: '1-abc123'
})),
updateDocument: jest.fn().mockImplementation((doc) => ({
...doc,
_rev: '2-def456'
})),
deleteDocument: jest.fn(),
findByType: jest.fn().mockResolvedValue([]),
findUserById: jest.fn(),