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:
William Valentin
2025-11-03 00:07:20 -08:00
parent 0f8d7ab83c
commit c17019360c
4 changed files with 323 additions and 460 deletions

View File

@@ -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();