@@ -73,19 +73,26 @@ describe('CodeAssistServer', () => {
7373 LlmRole . MAIN ,
7474 ) ;
7575
76- expect ( mockRequest ) . toHaveBeenCalledWith (
77- expect . objectContaining ( {
78- url : expect . stringContaining ( ':generateContent' ) ,
79- method : 'POST' ,
80- headers : {
81- 'Content-Type' : 'application/json' ,
82- 'x-custom-header' : 'test-value' ,
83- } ,
84- responseType : 'json' ,
85- body : expect . any ( String ) ,
86- signal : undefined ,
87- } ) ,
88- ) ;
76+ expect ( mockRequest ) . toHaveBeenCalledWith ( {
77+ url : expect . stringContaining ( ':generateContent' ) ,
78+ method : 'POST' ,
79+ headers : {
80+ 'Content-Type' : 'application/json' ,
81+ 'x-custom-header' : 'test-value' ,
82+ } ,
83+ responseType : 'json' ,
84+ body : expect . any ( String ) ,
85+ signal : undefined ,
86+ retryConfig : {
87+ retry : 3 ,
88+ noResponseRetries : 3 ,
89+ statusCodesToRetry : [
90+ [ 429 , 429 ] ,
91+ [ 499 , 499 ] ,
92+ [ 500 , 599 ] ,
93+ ] ,
94+ } ,
95+ } ) ;
8996
9097 const requestBody = JSON . parse ( mockRequest . mock . calls [ 0 ] [ 0 ] . body ) ;
9198 expect ( requestBody . user_prompt_id ) . toBe ( 'user-prompt-id' ) ;
@@ -393,19 +400,26 @@ describe('CodeAssistServer', () => {
393400 results . push ( res ) ;
394401 }
395402
396- expect ( mockRequest ) . toHaveBeenCalledWith (
397- expect . objectContaining ( {
398- url : expect . stringContaining ( ':streamGenerateContent' ) ,
399- method : 'POST' ,
400- params : { alt : 'sse' } ,
401- responseType : 'stream' ,
402- body : expect . any ( String ) ,
403- headers : {
404- 'Content-Type' : 'application/json' ,
405- } ,
406- signal : undefined ,
407- } ) ,
408- ) ;
403+ expect ( mockRequest ) . toHaveBeenCalledWith ( {
404+ url : expect . stringContaining ( ':streamGenerateContent' ) ,
405+ method : 'POST' ,
406+ params : { alt : 'sse' } ,
407+ responseType : 'stream' ,
408+ body : expect . any ( String ) ,
409+ headers : {
410+ 'Content-Type' : 'application/json' ,
411+ } ,
412+ signal : undefined ,
413+ retryConfig : {
414+ retry : 3 ,
415+ noResponseRetries : 3 ,
416+ statusCodesToRetry : [
417+ [ 429 , 429 ] ,
418+ [ 499 , 499 ] ,
419+ [ 500 , 599 ] ,
420+ ] ,
421+ } ,
422+ } ) ;
409423
410424 expect ( results ) . toHaveLength ( 2 ) ;
411425 expect ( results [ 0 ] . candidates ?. [ 0 ] . content ?. parts ?. [ 0 ] . text ) . toBe ( 'Hello' ) ;
0 commit comments