@@ -24,7 +24,7 @@ describe("API Tests", function () {
2424 . then ( function ( ) {
2525 r = ( path , options ) => {
2626 options = options || { } ;
27- path = path || '' ;
27+ path = path || "" ;
2828 const url = `${ options . url || apiUrl } ${ path } ` ;
2929 delete options . url ;
3030 const fetchOptions = {
@@ -81,7 +81,9 @@ describe("API Tests", function () {
8181 } ) ;
8282
8383 it ( "GET /api/routes fetches the routing table" , function ( done ) {
84- r ( ) . then ( res => res . json ( ) ) . then ( function ( reply ) {
84+ r ( )
85+ . then ( ( res ) => res . json ( ) )
86+ . then ( function ( reply ) {
8587 var keys = Object . keys ( reply ) ;
8688 expect ( keys . length ) . toEqual ( 1 ) ;
8789 expect ( keys ) . toContain ( "/" ) ;
@@ -97,7 +99,7 @@ describe("API Tests", function () {
9799 . then ( function ( ) {
98100 return r ( path ) ;
99101 } )
100- . then ( res => res . json ( ) )
102+ . then ( ( res ) => res . json ( ) )
101103 . then ( function ( reply ) {
102104 var keys = Object . keys ( reply ) ;
103105 expect ( keys ) . toContain ( "target" ) ;
@@ -120,10 +122,10 @@ describe("API Tests", function () {
120122 var target = "http://127.0.0.1:" + port ;
121123
122124 r ( "/user/foo" , {
123- method : ' POST' ,
125+ method : " POST" ,
124126 body : JSON . stringify ( { target : target } ) ,
125127 } )
126- . then ( res => res . text ( ) )
128+ . then ( ( res ) => res . text ( ) )
127129 . then ( ( body ) => {
128130 expect ( body ) . toEqual ( "" ) ;
129131 } )
@@ -143,7 +145,7 @@ describe("API Tests", function () {
143145 method : "POST" ,
144146 body : JSON . stringify ( { target : target } ) ,
145147 } )
146- . then ( res => res . text ( ) )
148+ . then ( ( res ) => res . text ( ) )
147149 . then ( ( body ) => {
148150 expect ( body ) . toEqual ( "" ) ;
149151 } )
@@ -162,11 +164,11 @@ describe("API Tests", function () {
162164 it ( "POST /api/routes creates a new root route" , function ( done ) {
163165 var port = 8998 ;
164166 var target = "http://127.0.0.1:" + port ;
165- r ( '' , {
167+ r ( "" , {
166168 method : "POST" ,
167169 body : JSON . stringify ( { target : target } ) ,
168170 } )
169- . then ( res => res . text ( ) )
171+ . then ( ( res ) => res . text ( ) )
170172 . then ( ( body ) => {
171173 expect ( body ) . toEqual ( "" ) ;
172174 return proxy . _routes . get ( "/" ) ;
@@ -188,7 +190,7 @@ describe("API Tests", function () {
188190 . then ( ( ) => proxy . _routes . get ( path ) )
189191 . then ( ( route ) => expect ( route . target ) . toEqual ( target ) )
190192 . then ( ( ) => r ( path , { url : apiUrl , method : "DELETE" } ) )
191- . then ( res => res . text ( ) )
193+ . then ( ( res ) => res . text ( ) )
192194 . then ( ( body ) => expect ( body ) . toEqual ( "" ) )
193195 . then ( ( ) => proxy . _routes . get ( path ) )
194196 . then ( ( deletedRoute ) => expect ( deletedRoute ) . toBe ( undefined ) )
@@ -235,27 +237,29 @@ describe("API Tests", function () {
235237 var seen = 0 ;
236238 var doReq = function ( i ) {
237239 var t = tests [ i ] ;
238- return r ( "?inactiveSince=" + t . since . toISOString ( ) ) . then ( res => res . json ( ) ) . then ( function ( routes ) {
239- var routeKeys = Object . keys ( routes ) ;
240- var expectedKeys = Object . keys ( t . expected ) ;
240+ return r ( "?inactiveSince=" + t . since . toISOString ( ) )
241+ . then ( ( res ) => res . json ( ) )
242+ . then ( function ( routes ) {
243+ var routeKeys = Object . keys ( routes ) ;
244+ var expectedKeys = Object . keys ( t . expected ) ;
241245
242- routeKeys . forEach ( function ( key ) {
243- // check that all routes are expected
244- expect ( expectedKeys ) . toContain ( key ) ;
245- } ) ;
246+ routeKeys . forEach ( function ( key ) {
247+ // check that all routes are expected
248+ expect ( expectedKeys ) . toContain ( key ) ;
249+ } ) ;
246250
247- expectedKeys . forEach ( function ( key ) {
248- // check that all expected routes are found
249- expect ( routeKeys ) . toContain ( key ) ;
250- } ) ;
251+ expectedKeys . forEach ( function ( key ) {
252+ // check that all expected routes are found
253+ expect ( routeKeys ) . toContain ( key ) ;
254+ } ) ;
251255
252- seen += 1 ;
253- if ( seen === tests . length ) {
254- done ( ) ;
255- } else {
256- return doReq ( seen ) ;
257- }
258- } ) ;
256+ seen += 1 ;
257+ if ( seen === tests . length ) {
258+ done ( ) ;
259+ } else {
260+ return doReq ( seen ) ;
261+ }
262+ } ) ;
259263 } ;
260264
261265 proxy
0 commit comments