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:
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user