test(ratings): add comprehensive E2E test for ratings & stats flow
Add end-to-end test verifying the complete ratings and stats update flow: - Auto match creation from suggestion acceptance - Both users rating each other - Stats updated exactly once (recordingsDone/recordingsReceived) - Manual matches do NOT update stats - Double-rating prevention (idempotency) Test coverage (9 scenarios): - STEP 1-3: Event creation, user enrollment, heat declaration - STEP 4: Matching algorithm execution + saveMatchingResults fix - STEP 5: Suggestion acceptance creates auto match (source='auto') - STEP 6a: First rating (no stats update yet) - STEP 6b: Second rating triggers stats update + match completion - STEP 7: Verify duplicate rating prevention - STEP 8: Verify manual matches don't affect fairness stats Infrastructure: - Add jest.setup.js to load .env.development for all tests - Update package.json to use setupFilesAfterEnv Documentation: - Mark S10 (Ratings & Stats) as ✅ IMPLEMENTED in TODO.md - Remove from Critical Gaps section - Add detailed implementation references All tests passing ✅
This commit is contained in:
5
backend/jest.setup.js
Normal file
5
backend/jest.setup.js
Normal file
@@ -0,0 +1,5 @@
|
||||
/**
|
||||
* Jest setup file - runs before all tests
|
||||
* Loads environment variables from .env.development
|
||||
*/
|
||||
require('dotenv').config({ path: '.env.development' });
|
||||
Reference in New Issue
Block a user