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()
|
.fn()
|
||||||
.mockResolvedValue(
|
.mockResolvedValue(
|
||||||
createMockResponse() as unknown as Response
|
createMockResponse() as unknown as Response
|
||||||
) as jest.MockedFunction<typeof fetch>;
|
) as unknown as jest.MockedFunction<typeof fetch>;
|
||||||
|
|
||||||
// Mock FormData with proper implementation
|
// Mock FormData with proper implementation
|
||||||
class MockFormDataImpl implements MockFormData {
|
class MockFormDataImpl implements MockFormData {
|
||||||
@@ -362,6 +362,7 @@ const SUPPRESSED_PATTERNS = [
|
|||||||
'📧 Mailgun Service',
|
'📧 Mailgun Service',
|
||||||
'Failed to send verification email',
|
'Failed to send verification email',
|
||||||
'Email sending failed',
|
'Email sending failed',
|
||||||
|
'Configured for production with domain:',
|
||||||
|
|
||||||
// Auth flow logging
|
// Auth flow logging
|
||||||
'🔐 Login attempt for:',
|
'🔐 Login attempt for:',
|
||||||
@@ -370,10 +371,17 @@ const SUPPRESSED_PATTERNS = [
|
|||||||
'🔍 Comparing passwords:',
|
'🔍 Comparing passwords:',
|
||||||
'❌ Password mismatch',
|
'❌ Password mismatch',
|
||||||
'✅ Login successful for:',
|
'✅ Login successful for:',
|
||||||
|
'Registration failed: User already exists',
|
||||||
|
'Password mismatch',
|
||||||
|
'User not found for email:',
|
||||||
|
|
||||||
// Database warnings
|
// Database warnings
|
||||||
'CouchDB connection',
|
'CouchDB connection',
|
||||||
'Mock database operation',
|
'Mock database operation',
|
||||||
|
|
||||||
|
// JSDOM navigation warnings
|
||||||
|
'Error: Not implemented: navigation',
|
||||||
|
'Not implemented: navigation (except hash changes)',
|
||||||
];
|
];
|
||||||
|
|
||||||
const shouldSuppressMessage = (message: string): boolean => {
|
const shouldSuppressMessage = (message: string): boolean => {
|
||||||
|
|||||||
Reference in New Issue
Block a user