app.e2e-spec.ts 630 B

123456789101112131415161718192021222324
  1. import { Test, TestingModule } from '@nestjs/testing';
  2. import { INestApplication } from '@nestjs/common';
  3. import * as request from 'supertest';
  4. import { AppModule } from './../src/app.module';
  5. describe('AppController (e2e)', () => {
  6. let app: INestApplication;
  7. beforeEach(async () => {
  8. const moduleFixture: TestingModule = 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. });