File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change
1
+ import { Test , TestingModule } from '@nestjs/testing' ;
2
+ import { AppController } from './app.controller' ;
3
+
4
+ describe ( 'AppController' , ( ) => {
5
+ let app : TestingModule ;
6
+
7
+ beforeAll ( async ( ) => {
8
+ app = await Test . createTestingModule ( {
9
+ controllers : [ AppController ] ,
10
+ } ) . compile ( ) ;
11
+ } ) ;
12
+
13
+ describe ( 'healthCheck' , ( ) => {
14
+ it ( 'should return the health check info' , ( ) => {
15
+ const appController = app . get < AppController > ( AppController ) ;
16
+ expect ( appController . healthCheck ( ) ) . toStrictEqual ( {
17
+ message :'Service is alive' ,
18
+ status : 200 ,
19
+ } ) ;
20
+ } ) ;
21
+ } ) ;
22
+ } ) ;
Original file line number Diff line number Diff line change
1
+ import { Controller , Get } from '@nestjs/common' ;
2
+
3
+ @Controller ( )
4
+ export class AppController {
5
+ @Get ( '/health' )
6
+ healthCheck ( ) {
7
+ return {
8
+ message : 'Service is alive' ,
9
+ status : 200 ,
10
+ } ;
11
+ }
12
+ }
You can’t perform that action at this time.
0 commit comments