targo-backend/test/health.e2e-spec.ts
2025-07-15 11:46:12 -04:00

30 lines
798 B
TypeScript

import { INestApplication } from '@nestjs/common';
import { Test, TestingModule } from '@nestjs/testing';
import * as request from 'supertest';
import { AppModule } from './../src/app.module';
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" }', () => {
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
return request(app.getHttpServer())
.get('/health')
.expect(200)
.expect({ status: 'ok' });
});
afterAll(async () => {
await app.close();
});
});