import { Test , TestingModule } from '@nestjs/testing' ; import { ConfigModule , ConfigService } from '@nestjs/config' ; import { AppController } from './app.controller' ; import { AppService } from './app.service' ; import { AuthModule } from './auth/auth.module' ; describe ( 'AppController' , ( ) => { let appController ; beforeEach ( async ( ) => { const app = await Test . createTestingModule ( { imports : [ ConfigModule . forRoot ( ) , AuthModule ] , controllers : [ AppController ] , providers : [ AppService ] , } ) . compile ( ) ; appController = app . get < AppController > ( AppController ) ; } ) ; describe ( 'root' , ( ) => { it ( 'should return "Hello World!"' , ( ) => { expect ( appController . getHello ( ) ) . toBe ( 'Hello World!' ) ; } ) ; } ) ; describe ( 'protected' , ( ) => { it ( 'should return "This route is protected."' , ( ) => { expect ( appController . getProtected ( ) ) . toBe ( 'This route is protected.' ) ; } ) ; } ) ; } ) ;