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

@@ -46,7 +46,7 @@ class Badge {
updatedAt: new Date().toISOString()
};
const result = await couchdbService.insert(badge);
const result = await couchdbService.createDocument(badge);
return { ...badge, _rev: result.rev };
} catch (error) {
console.error('Error creating badge:', error);
@@ -67,7 +67,7 @@ class Badge {
updatedAt: new Date().toISOString()
};
const result = await couchdbService.insert(updatedBadge);
const result = await couchdbService.createDocument(updatedBadge);
return { ...updatedBadge, _rev: result.rev };
} catch (error) {
console.error('Error updating badge:', error);