miinventario-backend-v2/test/health.e2e-spec.ts
rckrdmrd 5a1c966ed2 Migración desde miinventario/backend - Estándar multi-repo v2
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 08:12:15 -06:00

50 lines
1.3 KiB
TypeScript

import { Test, TestingModule } from '@nestjs/testing';
import { INestApplication } from '@nestjs/common';
import * as request from 'supertest';
import { HealthModule } from '../src/modules/health/health.module';
describe('HealthController (e2e)', () => {
let app: INestApplication;
beforeAll(async () => {
const moduleFixture: TestingModule = await Test.createTestingModule({
imports: [HealthModule],
}).compile();
app = moduleFixture.createNestApplication();
await app.init();
});
afterAll(async () => {
await app.close();
});
describe('GET /health', () => {
it('should return health status', async () => {
const response = await request(app.getHttpServer())
.get('/health')
.expect(200);
expect(response.body).toMatchObject({
status: 'ok',
service: 'miinventario-api',
version: '0.1.0',
});
expect(response.body.timestamp).toBeDefined();
});
});
describe('GET /health/ready', () => {
it('should return readiness status', async () => {
const response = await request(app.getHttpServer())
.get('/health/ready')
.expect(200);
expect(response.body).toMatchObject({
status: 'ready',
});
expect(response.body.timestamp).toBeDefined();
});
});
});