@@ -166,25 +166,24 @@ describe('params reached to function', () => {
166
166
} )
167
167
168
168
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
+
176
180
attach (
177
181
'check headers from function' ,
178
182
`expected to include: ${ [ 'custom-header' , customHeader ] } \n actual: ${ JSON . stringify (
179
183
data ?. headers
180
184
) } `,
181
185
ContentType . TEXT
182
186
)
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 )
188
187
} )
189
188
190
189
test ( 'invoke with region overrides region in the client' , async ( ) => {
@@ -210,7 +209,7 @@ describe('params reached to function', () => {
210
209
211
210
log ( 'assert no error' )
212
211
const expected = {
213
- url : ' http://localhost:8000/mirror' ,
212
+ url : ` http://localhost:8000/mirror?forceFunctionRegion= ${ FunctionRegion . ApSoutheast1 } ` ,
214
213
method : 'POST' ,
215
214
headers : data ?. headers ?? [ ] ,
216
215
body : '' ,
0 commit comments