File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -113,4 +113,28 @@ describe('expectBody', () => {
113113 } )
114114} )
115115
116+ describe ( 'expect' , ( ) => {
117+ it ( 'uses expectStatus if first arg is number' , async ( ) => {
118+ const handler : Handler = ( ) => new Response ( 'Hello World' )
119+ const fetch = makeFetch ( handler )
120+ const res = await fetch ( '/' )
121+ res . expect ( 200 )
122+ } )
123+ it ( 'uses expectHeader if two arguments' , async ( ) => {
124+ const handler : Handler = ( ) =>
125+ new Response ( 'Hello World' , {
126+ 'headers' : { 'Content-Type' : 'text/plain' } ,
127+ } )
128+ const fetch = makeFetch ( handler )
129+ const res = await fetch ( '/' )
130+ res . expect ( 'Content-Type' , 'text/plain' )
131+ } )
132+ it ( 'uses expectBody otherwise' , async ( ) => {
133+ const handler : Handler = ( ) => new Response ( 'Hello World' )
134+ const fetch = makeFetch ( handler )
135+ const res = await fetch ( '/' )
136+ res . expect ( 'Hello World' )
137+ } )
138+ } )
139+
116140run ( )
You can’t perform that action at this time.
0 commit comments