2022-02-20 19:51:55 +08:00
|
|
|
import { Test, TestingModule } from '@nestjs/testing';
|
|
|
|
import { INestApplication } from '@nestjs/common';
|
|
|
|
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();
|
|
|
|
await app.init();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('/ (GET)', () => {
|
2022-03-12 11:27:56 +08:00
|
|
|
return request(app.getHttpServer()).get('/').expect(200).expect('Hello World!');
|
2022-02-20 19:51:55 +08:00
|
|
|
});
|
|
|
|
});
|