Untitled
unknown
typescript
a month ago
749 B
6
Indexable
import { Test, TestingModule } from '@nestjs/testing'; import { INestApplication } from '@nestjs/common'; import * as request from 'supertest'; import { AppModule } from './../src/app.module'; describe('AppModule (e2e)', () => { let app: INestApplication; beforeAll(async () => { const moduleFixture: TestingModule = await Test.createTestingModule({ imports: [AppModule], }).compile(); app = moduleFixture.createNestApplication(); await app.init(); }); it('/users (GET)', () => { return request(app.getHttpServer()).get('/users').expect(200); }); it('/posts (GET)', () => { return request(app.getHttpServer()).get('/posts').expect(200); }); afterAll(async () => { await app.close(); }); });
Editor is loading...
Leave a Comment