32 lines
862 B
TypeScript
32 lines
862 B
TypeScript
import { INestApplication } from '@nestjs/common';
|
|
import { Test, TestingModule } from '@nestjs/testing';
|
|
import * as request from 'supertest';
|
|
import { AppModule } from './../src/app.module';
|
|
import { PrismaService } from 'src/prisma/prisma.service';
|
|
|
|
describe('HealthController (e2e)', () => {
|
|
let app: INestApplication;
|
|
|
|
beforeAll(async () => {
|
|
const moduleFixture: TestingModule = await Test.createTestingModule({
|
|
imports: [AppModule],
|
|
}).compile();
|
|
|
|
app = moduleFixture.createNestApplication();
|
|
await app.init();
|
|
});
|
|
|
|
it('/health (GET) → 200 & { status: "ok" }', () => {
|
|
return request(app.getHttpServer())
|
|
.get('/health')
|
|
.expect(200)
|
|
.expect({ status: 'ok' });
|
|
});
|
|
|
|
afterAll(async () => {
|
|
await app.close();
|
|
const prisma = app.get(PrismaService);
|
|
await prisma.$disconnect();
|
|
});
|
|
});
|