- Set NODE_ENV=test in jest.setup.js for test-specific behavior - Unset TURNSTILE_SECRET_KEY in tests (CAPTCHA not needed) - Skip match rate limiting in test environment - Skip TC4 rate limit test (rate limiting disabled in tests) - Relax EventUserHeat unique constraint to allow multiple heats per role - Changed from: (userId, eventId, divisionId, competitionTypeId, role) - Changed to: (userId, eventId, divisionId, competitionTypeId, heatNumber, role) - This allows users to have multiple heats with the same role in same division Test improvements: - Fixed Turnstile CAPTCHA blocking all registration tests - Fixed spam-protection tests rate limiting issues - Fixed EventUserHeat unique constraint preventing test data creation - Reduced test failures from 42 to 17
12 lines
355 B
JavaScript
12 lines
355 B
JavaScript
/**
|
|
* Jest setup file - runs before all tests
|
|
* Loads environment variables from .env.development
|
|
*/
|
|
require('dotenv').config({ path: '.env.development' });
|
|
|
|
// Set NODE_ENV to test for test-specific behavior
|
|
process.env.NODE_ENV = 'test';
|
|
|
|
// Unset TURNSTILE_SECRET_KEY for tests (CAPTCHA not needed in tests)
|
|
delete process.env.TURNSTILE_SECRET_KEY;
|