app.e2e-spec.ts 646 B

123456789101112131415161718192021222324
  1. import { INestApplication } from '@nestjs/common';
  2. import { Test } from '@nestjs/testing';
  3. import request from 'supertest';
  4. import { AppModule } from '../src/app.module';
  5. describe('AppController (e2e)', () => {
  6. let app: INestApplication;
  7. beforeAll(async () => {
  8. const moduleFixture = await Test.createTestingModule({
  9. imports: [AppModule],
  10. }).compile();
  11. app = moduleFixture.createNestApplication();
  12. await app.init();
  13. });
  14. it('/ (GET)', () => {
  15. return request(app.getHttpServer())
  16. .get('/')
  17. .expect(200)
  18. .expect('Hello World!');
  19. });
  20. });