@@ -166,25 +166,24 @@ describe('params reached to function', () => {
166166 } )
167167
168168 log ( 'assert no error' )
169- const expected = {
170- url : 'http://localhost:8000/mirror' ,
171- method : 'POST' ,
172- headers : data ?. headers ?? [ ] ,
173- body : '' ,
174- }
175- expect ( data ) . toEqual ( expected )
169+ expect ( error ) . toBeNull ( )
170+
171+ // Check that x-region header is present
172+ expect (
173+ ( data ?. headers as [ Array < string > ] ) . filter ( ( [ k , v ] ) => k === 'x-region' && v === validRegion )
174+ . length > 0
175+ ) . toBe ( true )
176+
177+ // Check that the URL contains the forceFunctionRegion query parameter
178+ expect ( data ?. url ) . toContain ( `forceFunctionRegion=${ validRegion } ` )
179+
176180 attach (
177181 'check headers from function' ,
178182 `expected to include: ${ [ 'custom-header' , customHeader ] } \n actual: ${ JSON . stringify (
179183 data ?. headers
180184 ) } `,
181185 ContentType . TEXT
182186 )
183- console . log ( data ?. headers )
184- expect (
185- ( data ?. headers as [ Array < string > ] ) . filter ( ( [ k , v ] ) => k === 'x-region' && v === validRegion )
186- . length > 0
187- ) . toBe ( true )
188187 } )
189188
190189 test ( 'invoke with region overrides region in the client' , async ( ) => {
@@ -210,7 +209,7 @@ describe('params reached to function', () => {
210209
211210 log ( 'assert no error' )
212211 const expected = {
213- url : ' http://localhost:8000/mirror' ,
212+ url : ` http://localhost:8000/mirror?forceFunctionRegion= ${ FunctionRegion . ApSoutheast1 } ` ,
214213 method : 'POST' ,
215214 headers : data ?. headers ?? [ ] ,
216215 body : '' ,
0 commit comments