File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -101,6 +101,34 @@ describe("server", () => {
101101 ) ;
102102 } ) ;
103103 } ) ;
104+ // 9.1
105+ it ( 'should return `{ word: "hello" }` from GET requests to "/echo/hello"' , ( ) => {
106+ return request ( server )
107+ . get ( "/echo/hello" )
108+ . expect ( "Content-type" , / a p p l i c a t i o n \/ j s o n / )
109+ . expect ( 200 )
110+ . then ( response => {
111+ assert . ok ( response . body , "Body does not contain json" ) ;
112+ assert . equal ( response . body . echo , "hello" ) ;
113+ } ) ;
114+ } ) ;
115+ it ( 'should return `{ word: "ANYWORD" }` from GET requests to "/echo/ANYWORD"' , ( ) => {
116+ const randomWord =
117+ Math . random ( )
118+ . toString ( 36 )
119+ . substring ( 2 , 15 ) +
120+ Math . random ( )
121+ . toString ( 36 )
122+ . substring ( 2 , 15 ) ;
123+ return request ( server )
124+ . get ( `/echo/${ randomWord } ` )
125+ . expect ( "Content-type" , / a p p l i c a t i o n \/ j s o n / )
126+ . expect ( 200 )
127+ . then ( response => {
128+ assert . ok ( response . body , "Body does not contain json" ) ;
129+ assert . equal ( response . body . echo , randomWord ) ;
130+ } ) ;
131+ } ) ;
104132 after ( ( ) => {
105133 server . close ( ) ;
106134 } ) ;
You can’t perform that action at this time.
0 commit comments