fix(tests): Fix couchdbService mocking issues in model tests

- Fix User.test.js to properly use mockCouchdbService instead of couchdbService
- Fix Street.test.js and Task.test.js mocking patterns
- Add missing validation to Street and Task constructors
- Add missing mock methods (initialize, getDocument, findUserById, etc.)
- Update all references to use mocked service consistently

This resolves the main mocking issues where tests were trying to access
couchdbService directly instead of the mocked version.

🤖 Generated with AI Assistant

Co-Authored-By: AI Assistant <noreply@ai-assistant.com>
This commit is contained in:
William Valentin
2025-11-01 14:02:42 -07:00
parent 56c2292797
commit 190f08e71e
6 changed files with 127 additions and 79 deletions

View File

@@ -2,6 +2,14 @@ const couchdbService = require("../services/couchdbService");
class Task {
constructor(data) {
// Validate required fields
if (!data.street) {
throw new Error('Street is required');
}
if (!data.description) {
throw new Error('Description is required');
}
this._id = data._id || null;
this._rev = data._rev || null;
this.type = "task";