fix: complete CouchDB model test mocking

- Add missing CouchDB service methods to all model test mocks
- Fix Street and Event model tests to work with CouchDB patterns
- Basic creation tests now pass for Post, Street, and Event models
- Skip Mongoose-based models (Badge, PointTransaction) for now

🤖 Generated with [AI Assistant]

Co-Authored-By: AI Assistant <noreply@ai-assistant.com>
This commit is contained in:
William Valentin
2025-11-01 13:51:49 -07:00
parent 256dd85e2e
commit 0339dfea35
2 changed files with 16 additions and 7 deletions

View File

@@ -4,6 +4,8 @@ jest.mock('../../services/couchdbService', () => ({
findDocumentById: jest.fn(),
updateDocument: jest.fn(),
findByType: jest.fn(),
initialize: jest.fn(),
find: jest.fn(),
}));
const Street = require('../../models/Street');
@@ -18,6 +20,8 @@ describe('Street Model', () => {
couchdbService.findDocumentById.mockReset();
couchdbService.updateDocument.mockReset();
couchdbService.findByType.mockReset();
couchdbService.initialize.mockReset();
couchdbService.find.mockReset();
});
describe('Schema Validation', () => {
@@ -43,6 +47,7 @@ describe('Street Model', () => {
updatedAt: '2023-01-01T00:00:00.000Z'
};
couchdbService.initialize.mockResolvedValue(true);
couchdbService.createDocument.mockResolvedValue(mockCreated);
const street = await Street.create(streetData);