File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ module . exports = sendWrapper => {
2+ async function GET ( req , res ) {
3+ sendWrapper ( req , res , null , { status : "available" } ) ;
4+ }
5+
6+ GET . apiDoc = {
7+ tags : [ "Ping" ] ,
8+ summary : "Check API availability" ,
9+ responses : {
10+ 200 : {
11+ description : "A simple availability response" ,
12+ content : {
13+ "application/json" : {
14+ schema : {
15+ type : "object" ,
16+ properties : {
17+ status : {
18+ type : "string" ,
19+ example : "available"
20+ }
21+ } ,
22+ required : [ "status" ]
23+ }
24+ }
25+ }
26+ } ,
27+ default : {
28+ $ref : "#/components/responses/Error"
29+ }
30+ } ,
31+ "x-default-ttl" : - 1
32+ } ;
33+
34+ return {
35+ GET
36+ } ;
37+ } ;
Original file line number Diff line number Diff line change 1+ const { expect } = require ( "chai" ) ;
2+ const request = require ( "supertest" ) ;
3+
4+ describe ( "Ping" , ( ) => {
5+ describe ( "index" , ( ) => {
6+ it ( "renders a ping response" , function ( done ) {
7+ request ( this . app ) . get ( "/v2/ping" )
8+ . expect ( res => {
9+ expect ( res . body . status ) . to . eq ( "available" ) ;
10+ expect ( res . headers [ "cache-control" ] ) . to . eq (
11+ "private, no-cache, no-store, must-revalidate"
12+ ) ;
13+ expect ( res . headers . expires ) . to . eq ( "-1" ) ;
14+ expect ( res . headers . pragma ) . to . eq ( "no-cache" ) ;
15+ } ) . expect ( "Content-Type" , / j s o n / )
16+ . expect ( 200 , done ) ;
17+ } ) ;
18+ } ) ;
19+ } ) ;
You can’t perform that action at this time.
0 commit comments