File tree Expand file tree Collapse file tree 2 files changed +13
-5
lines changed
Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,13 @@ import { get } from "../testing/testingTools";
44
55describe ( "general app test" , ( ) => {
66 it ( "app should be running" , async ( ) => {
7- const response = await get ( "/status" , undefined ) . expect ( StatusCodes . OK ) ;
7+ let response = await get ( "/" , undefined ) . expect ( StatusCodes . OK ) ;
8+ expect ( response . body ) . toMatchObject ( {
9+ ok : true ,
10+ message : "API is alive!" ,
11+ } ) ;
12+
13+ response = await get ( "/status" , undefined ) . expect ( StatusCodes . OK ) ;
814 expect ( response . body ) . toMatchObject ( {
915 ok : true ,
1016 message : "API is alive!" ,
Original file line number Diff line number Diff line change 1- import express from "express" ;
1+ import express , { Request , Response } from "express" ;
22import { StatusCodes } from "http-status-codes" ;
33import { Config , EnvironmentEnum } from "./config" ;
44import { isTest } from "./utilities" ;
@@ -105,16 +105,18 @@ app.use("/speakers", speakersRouter);
105105app . use ( "/meetings" , meetingsRouter ) ;
106106app . use ( "/shifts" , shiftsRouter ) ;
107107
108- app . get ( "/ status" , ( req , res ) => {
108+ const status = ( req : Request , res : Response ) => {
109109 return res . status ( StatusCodes . OK ) . send ( {
110110 ok : true ,
111111 message : "API is alive!" ,
112112 timestamp : new Date ( ) . toISOString ( ) ,
113113 environment : Config . ENV ,
114114 } ) ;
115- } ) ;
115+ } ;
116+ app . get ( "/status" , status ) ;
117+ app . get ( "/" , status ) ;
116118
117- app . use ( "/" , ( req , res ) =>
119+ app . use ( ( req , res ) =>
118120 res . status ( StatusCodes . NOT_FOUND ) . send ( {
119121 error : "EndpointNotFound" ,
120122 } )
You can’t perform that action at this time.
0 commit comments