import { config } from '../../config/env'; import { fileStorageService } from '../../services/fileStorageService'; // Mock environment variables const originalEnv = process.env; describe('Deployment Configuration Tests', () => { beforeEach(() => { jest.resetModules(); process.env = { ...originalEnv }; }); afterAll(() => { process.env = originalEnv; }); describe('Environment Configuration', () => { it('should have required GCS configuration', () => { expect(config.googleCloud).toBeDefined(); expect(config.googleCloud.gcsBucketName).toBeDefined(); expect(config.googleCloud.projectId).toBeDefined(); expect(config.googleCloud.applicationCredentials).toBeDefined(); }); it('should not have local storage configuration', () => { // Verify no local storage paths are configured expect(config.upload?.uploadDir).toContain('/tmp/'); expect(config.upload?.maxFileSize).toBeDefined(); }); it('should have proper database configuration', () => { expect(config.supabase).toBeDefined(); expect(config.supabase.url).toBeDefined(); }); it('should have proper authentication configuration', () => { expect(config.jwt).toBeDefined(); expect(config.jwt.secret).toBeDefined(); }); }); describe('GCS Service Configuration', () => { it('should initialize GCS service with proper configuration', async () => { const testConnection = await fileStorageService.testConnection(); expect(typeof testConnection).toBe('boolean'); }); it('should have proper bucket configuration', () => { expect(config.googleCloud.gcsBucketName).toMatch(/^[a-z0-9-]+$/); expect(config.googleCloud.projectId).toMatch(/^[a-z0-9-]+$/); }); }); describe('Cloud-Only Architecture Validation', () => { it('should not reference local file system paths', () => { // This test ensures no local file system operations are configured const configString = JSON.stringify(config); expect(configString).not.toContain('/uploads/'); expect(configString).not.toContain('localPath'); }); it('should have cloud service configurations', () => { expect(config.googleCloud).toBeDefined(); expect(config.supabase).toBeDefined(); expect(config.redis).toBeDefined(); }); }); });