2026-10-13 18:13:49 -05:00
|
|
|
import { Test } from '@nestjs/testing';
|
|
|
|
|
import type { INestApplication } from '@nestjs/common';
|
|
|
|
|
import request from 'supertest';
|
2026-10-13 18:29:13 -05:00
|
|
|
|
|
|
|
|
// Valores ficticios: este e2e no se conecta a SAP (el login es perezoso).
|
|
|
|
|
process.env.SAPB1_SL_URL ??= 'https://sap.invalid:50000/b1s/v1';
|
|
|
|
|
process.env.SAPB1_SL_COMPANYDB ??= 'DB';
|
|
|
|
|
process.env.SAPB1_SL_USER ??= 'u';
|
|
|
|
|
process.env.SAPB1_SL_PASSWORD ??= 'p';
|
2026-10-13 18:13:49 -05:00
|
|
|
|
|
|
|
|
describe('Health (e2e)', () => {
|
|
|
|
|
let app: INestApplication;
|
|
|
|
|
|
|
|
|
|
beforeAll(async () => {
|
2026-10-13 18:29:13 -05:00
|
|
|
const { AppModule } = await import('../src/app.module.js');
|
2026-10-13 18:13:49 -05:00
|
|
|
const moduleRef = await Test.createTestingModule({ imports: [AppModule] }).compile();
|
|
|
|
|
app = moduleRef.createNestApplication();
|
|
|
|
|
app.setGlobalPrefix('api');
|
|
|
|
|
await app.init();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
afterAll(async () => {
|
|
|
|
|
await app.close();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('GET /api/health responde ok', async () => {
|
|
|
|
|
const res = await request(app.getHttpServer()).get('/api/health').expect(200);
|
|
|
|
|
expect(res.body.status).toBe('ok');
|
|
|
|
|
});
|
|
|
|
|
});
|