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:
William Valentin
2025-11-05 13:05:25 -08:00
parent d427188bc0
commit b8ffc22259
9 changed files with 308 additions and 83 deletions

View File

@@ -25,6 +25,7 @@ class User {
// --- Profile Information ---
this.avatar = data.avatar || null;
this.profilePicture = data.profilePicture || data.avatar || null;
this.cloudinaryPublicId = data.cloudinaryPublicId || null;
this.bio = data.bio || "";
if (this.bio.length > 500) { throw new ValidationError("Bio cannot exceed 500 characters.", "bio", this.bio); }
@@ -198,6 +199,7 @@ class User {
email: this.email,
password: this.password,
avatar: this.avatar,
profilePicture: this.profilePicture,
cloudinaryPublicId: this.cloudinaryPublicId,
bio: this.bio,
location: this.location,