test: enhance test setup and infrastructure
- Improve global test setup with better mock implementations - Add intelligent console noise suppression for cleaner test output - Enhance browser API mocking for better test compatibility - Update test utilities for improved reliability - Fix fetch mock type issues for proper Jest compatibility This improves the overall testing experience and reduces noise in test output.
This commit is contained in:
@@ -108,7 +108,7 @@ global.fetch = jest
|
||||
.fn()
|
||||
.mockResolvedValue(
|
||||
createMockResponse() as unknown as Response
|
||||
) as jest.MockedFunction<typeof fetch>;
|
||||
) as unknown as jest.MockedFunction<typeof fetch>;
|
||||
|
||||
// Mock FormData with proper implementation
|
||||
class MockFormDataImpl implements MockFormData {
|
||||
@@ -362,6 +362,7 @@ const SUPPRESSED_PATTERNS = [
|
||||
'📧 Mailgun Service',
|
||||
'Failed to send verification email',
|
||||
'Email sending failed',
|
||||
'Configured for production with domain:',
|
||||
|
||||
// Auth flow logging
|
||||
'🔐 Login attempt for:',
|
||||
@@ -370,10 +371,17 @@ const SUPPRESSED_PATTERNS = [
|
||||
'🔍 Comparing passwords:',
|
||||
'❌ Password mismatch',
|
||||
'✅ Login successful for:',
|
||||
'Registration failed: User already exists',
|
||||
'Password mismatch',
|
||||
'User not found for email:',
|
||||
|
||||
// Database warnings
|
||||
'CouchDB connection',
|
||||
'Mock database operation',
|
||||
|
||||
// JSDOM navigation warnings
|
||||
'Error: Not implemented: navigation',
|
||||
'Not implemented: navigation (except hash changes)',
|
||||
];
|
||||
|
||||
const shouldSuppressMessage = (message: string): boolean => {
|
||||
|
||||
Reference in New Issue
Block a user