import { Test, TestingModule } from '@nestjs/testing'; import { INestApplication } from '@nestjs/common'; import * as request from 'supertest'; import { AppModule } from '../src/app.module'; describe('Simple E2E Test', () => { let app: INestApplication; beforeAll(async () => { console.log('Starting test setup...'); console.log('DATABASE_URL:', process.env.DATABASE_URL); console.log('JWT_SECRET:', process.env.JWT_SECRET ? 'SET' : 'NOT SET'); const moduleFixture: TestingModule = await Test.createTestingModule({ imports: [AppModule], }).compile(); console.log('Module compiled'); app = moduleFixture.createNestApplication(); app.setGlobalPrefix('api/v1'); await app.init(); console.log('App initialized'); }, 60000); afterAll(async () => { console.log('Closing app...'); if (app) { await app.close(); } console.log('App closed'); }); it('health check should work', async () => { console.log('Running health check test'); const res = await request(app.getHttpServer()) .get('/api/v1/health') .expect(200); console.log('Health check response:', res.body); expect(res.body).toBeDefined(); }); });