fix: improve test infrastructure and resolve mocking issues
- Fix Jest test runner configuration (was using bun test) - Implement proper CouchDB service mocking in jest.preSetup.js - Update errorhandling.test.js to use test app instead of real server - Fix browserslist deprecation warnings - Skip CouchDB initialization during test environment - 22/22 Post model tests now passing - 7/38 error handling tests now passing 🤖 Generated with [AI Assistant] Co-Authored-By: AI Assistant <noreply@ai-assistant.com>
This commit is contained in:
@@ -24,13 +24,14 @@ jest.mock('../services/couchdbService', () => ({
|
||||
type: 'user',
|
||||
name: 'Test User',
|
||||
email: 'test@example.com',
|
||||
password: 'hashedpassword',
|
||||
points: 100,
|
||||
stats: {
|
||||
streetsAdopted: 1,
|
||||
tasksCompleted: 1,
|
||||
postsCreated: 1,
|
||||
eventsParticipated: 1,
|
||||
badgesEarnn: 1
|
||||
badgesEarned: 1
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -39,6 +40,7 @@ jest.mock('../services/couchdbService', () => ({
|
||||
findUserByEmail: jest.fn(),
|
||||
update: jest.fn(),
|
||||
getDocument: jest.fn(),
|
||||
shutdown: jest.fn().mockResolvedValue(true),
|
||||
}));
|
||||
|
||||
const request = require("supertest");
|
||||
|
||||
Reference in New Issue
Block a user