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