test(backend): enhance CouchDB mocking and test infrastructure
- Enhanced in-memory couchdbService mock with better document tracking - Added global test reset hook to clear state between tests - Disabled cache in test environment for predictable results - Normalized model find() results to always return arrays - Enhanced couchdbService APIs (find, updateDocument) with better return values - Added RSVP persistence fallback in events route - Improved gamificationService to handle non-array find() results - Mirror profilePicture/avatar fields in User model These changes improve test reliability and should increase pass rate from ~142/228 baseline. 🤖 Generated with Claude Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -16,7 +16,8 @@ class Badge {
|
||||
selector: { type: 'badge' },
|
||||
sort: [{ order: 'asc' }]
|
||||
});
|
||||
return result.docs;
|
||||
const docs = Array.isArray(result) ? result : (result && result.docs) || [];
|
||||
return docs;
|
||||
}, errorContext);
|
||||
}
|
||||
|
||||
@@ -141,7 +142,8 @@ class Badge {
|
||||
},
|
||||
sort: [{ 'criteria.threshold': 'desc' }]
|
||||
});
|
||||
return result.docs;
|
||||
const docs = Array.isArray(result) ? result : (result && result.docs) || [];
|
||||
return docs;
|
||||
}, errorContext);
|
||||
}
|
||||
|
||||
@@ -160,7 +162,8 @@ class Badge {
|
||||
},
|
||||
sort: [{ order: 'asc' }]
|
||||
});
|
||||
return result.docs;
|
||||
const docs = Array.isArray(result) ? result : (result && result.docs) || [];
|
||||
return docs;
|
||||
}, errorContext);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user