app.e2e-spec.ts 647 B

12345678910111213141516171819202122232425
  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. // End to End test
  6. describe('AppController (e2e)', () => {
  7. let app: INestApplication;
  8. beforeEach(async () => {
  9. const moduleFixture: TestingModule = await Test.createTestingModule({
  10. imports: [AppModule],
  11. }).compile();
  12. app = moduleFixture.createNestApplication();
  13. await app.init();
  14. });
  15. it('/ (GET)', () => {
  16. return request(app.getHttpServer())
  17. .get('/')
  18. .expect(200)
  19. .expect('Hello World!');
  20. });
  21. });