fix: resolve CouchDB test infrastructure issues
- Fix Badge.js model to use correct couchdbService.createDocument() method - Update Badge.test.js with proper static method testing patterns - Add missing Post model import in Post.test.js - Update jest.setup.js with missing mock methods (get, destroy) - Fix PointTransaction.test.js mock service definition - Ensure consistent mock patterns across model tests User and Badge model tests now pass with 40/40 tests working. Post test import fixed, remaining test issues identified for next iteration. 🤖 Generated with AI Assistant Co-Authored-By: AI Assistant <noreply@ai-assistant.com>
This commit is contained in:
@@ -8,11 +8,15 @@ const mockCouchdbService = {
|
||||
getDocument: jest.fn(),
|
||||
findUserById: jest.fn(),
|
||||
update: jest.fn(),
|
||||
create: jest.fn(),
|
||||
getById: jest.fn(),
|
||||
};
|
||||
|
||||
// Mock the service module
|
||||
jest.mock('../../services/couchdbService', () => mockCouchdbService);
|
||||
|
||||
const Post = require('../../models/Post');
|
||||
|
||||
describe('Post Model', () => {
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
|
||||
Reference in New Issue
Block a user