86211923db
Repository Interface Optimization: - Created IBaseRepository.ts and IPaginatedRepository.ts - Refactored all 7 repository interfaces to extend base interfaces - Eliminated ~200 lines of redundant code (70% reduction) - Improved type safety and maintainability Dependency Injection Improvements: - Added EmailService and GameTokenService to DIContainer - Updated CreateUserCommandHandler constructor for DI - Updated RequestPasswordResetCommandHandler constructor for DI - Enhanced testability and service consistency Environment Configuration: - Created comprehensive .env.example with 40+ variables - Organized into 12 logical sections (Database, Security, Email, etc.) - Added security guidelines and best practices - Documented all backend environment requirements Documentation: - Added comprehensive codebase review - Created refactoring summary report - Added frontend implementation guide Impact: Improved code quality, reduced maintenance overhead, enhanced developer experience
27 lines
785 B
TypeScript
27 lines
785 B
TypeScript
// Jest test setup file
|
|
import { jest } from '@jest/globals';
|
|
import { LoggingService } from '../src/Application/Services/LoggingService';
|
|
|
|
// Mock environment variables
|
|
process.env.NODE_ENV = 'test';
|
|
process.env.JWT_SECRET = 'test-jwt-secret';
|
|
process.env.EMAIL_HOST = 'test.smtp.com';
|
|
process.env.EMAIL_PORT = '587';
|
|
process.env.EMAIL_USER = 'test@example.com';
|
|
process.env.EMAIL_PASS = 'testpass';
|
|
process.env.EMAIL_FROM = 'test@example.com';
|
|
process.env.APP_BASE_URL = 'http://localhost:3000';
|
|
|
|
// Global test timeout
|
|
jest.setTimeout(10000);
|
|
|
|
// Global cleanup to prevent Jest from hanging
|
|
afterAll(async () => {
|
|
try {
|
|
await LoggingService.getInstance().shutdown();
|
|
} catch (error) {
|
|
// Ignore cleanup errors in tests
|
|
console.log('Test cleanup completed');
|
|
}
|
|
});
|