saveinmed/backoffice/test/app.e2e-spec.ts
2025-12-18 08:13:19 -03:00

31 lines
964 B
TypeScript

import { Test, TestingModule } from '@nestjs/testing';
import { INestApplication } from '@nestjs/common';
import { FastifyAdapter } from '@nestjs/platform-fastify';
import * as request from 'supertest';
import { AppModule } from './../src/app.module';
describe('AppController (e2e)', () => {
let app: INestApplication;
beforeEach(async () => {
const moduleFixture: TestingModule = await Test.createTestingModule({
imports: [AppModule],
}).compile();
app = moduleFixture.createNestApplication(
new FastifyAdapter(),
);
await app.init();
await app.getHttpAdapter().getInstance().ready();
});
afterEach(async () => {
await app.close();
});
// Since we don't have a root route, we can try to hit docs or a known route if any.
// Or check if the app initializes correctly.
it('should initialize', () => {
expect(app).toBeDefined();
});
});