32 lines
826 B
TypeScript
32 lines
826 B
TypeScript
import { Test, TestingModule } from '@nestjs/testing';
|
|
import { INestApplication } from '@nestjs/common';
|
|
import request from 'supertest';
|
|
import { App } from 'supertest/types';
|
|
import { HealthModule } from './../src/health/health.module';
|
|
|
|
describe('API (e2e)', () => {
|
|
let app: INestApplication<App>;
|
|
|
|
beforeEach(async () => {
|
|
const moduleFixture: TestingModule = await Test.createTestingModule({
|
|
imports: [HealthModule],
|
|
}).compile();
|
|
|
|
app = moduleFixture.createNestApplication();
|
|
app.setGlobalPrefix('api');
|
|
await app.init();
|
|
});
|
|
|
|
it('/api/health (GET)', () => {
|
|
return request(app.getHttpServer()).get('/api/health').expect(200).expect({
|
|
status: 'ok',
|
|
service: 'sinka-api',
|
|
stack: 'nestjs',
|
|
});
|
|
});
|
|
|
|
afterEach(async () => {
|
|
await app.close();
|
|
});
|
|
});
|