import { Test , TestingModule } from '@nestjs/testing' ; import * as request from 'supertest' ; import { AppModule } from '../src/app.module' ; console . log = jest . fn ( ) ; describe ( 'AppController (e2e)' , ( ) => { let app ; beforeAll ( async ( ) => { const moduleFixture = await Test . createTestingModule ( { imports : [ AppModule ] , } ) . compile ( ) ; app = moduleFixture . createNestApplication ( ) ; await app . init ( ) ; } ) ; afterAll ( async ( ) => { await app . close ( ) ; } ) ; it ( '/ (GET)' , ( ) => { return request ( app . getHttpServer ( ) ) . get ( '/' ) . expect ( 200 ) . expect ( 'Hello World!' ) ; } ) ; it ( '/?name=Test (GET)' , async ( ) => { return request ( app . getHttpServer ( ) ) . get ( '/?name=Test' ) . expect ( 200 ) . expect ( 'Hello Test!' ) ; } ) ; } ) ;