@@ -85,22 +85,40 @@ describe("browser action observe commands", () => {
8585 expect ( mocks . callBrowserRequest ) . not . toHaveBeenCalled ( ) ;
8686 } ) ;
8787
88- it ( "passes responsebody limits through to the request and outer timeout" , async ( ) => {
89- const program = createActionObserveProgram ( ) ;
88+ it . each ( [
89+ {
90+ label : "default" ,
91+ timeout : undefined ,
92+ operationTimeoutMs : undefined ,
93+ requestTimeoutMs : 25000 ,
94+ } ,
95+ { label : "minimum explicit" , timeout : "1" , operationTimeoutMs : 1 , requestTimeoutMs : 5001 } ,
96+ {
97+ label : "signed explicit" ,
98+ timeout : "+030000" ,
99+ operationTimeoutMs : 30000 ,
100+ requestTimeoutMs : 35000 ,
101+ } ,
102+ ] ) (
103+ "keeps the $label responsebody request open past its operation deadline" ,
104+ async ( { timeout, operationTimeoutMs, requestTimeoutMs } ) => {
105+ const program = createActionObserveProgram ( ) ;
106+ const args = [ "browser" , "responsebody" , "**/api" , "--max-chars" , "0100" ] ;
107+ if ( timeout !== undefined ) {
108+ args . push ( "--timeout-ms" , timeout ) ;
109+ }
90110
91- await program . parseAsync (
92- [ "browser" , "responsebody" , "**/api" , "--timeout-ms" , "+030000" , "--max-chars" , "0100" ] ,
93- { from : "user" } ,
94- ) ;
111+ await program . parseAsync ( args , { from : "user" } ) ;
95112
96- const request = mocks . callBrowserRequest . mock . calls . at ( - 1 ) ?. [ 1 ] as
97- | { body ?: { timeoutMs ?: number ; maxChars ?: number } }
98- | undefined ;
99- const options = mocks . callBrowserRequest . mock . calls . at ( - 1 ) ?. [ 2 ] as
100- | { timeoutMs ?: number }
101- | undefined ;
102- expect ( request ?. body ?. timeoutMs ) . toBe ( 30000 ) ;
103- expect ( request ?. body ?. maxChars ) . toBe ( 100 ) ;
104- expect ( options ?. timeoutMs ) . toBe ( 30000 ) ;
105- } ) ;
113+ const request = mocks . callBrowserRequest . mock . calls . at ( - 1 ) ?. [ 1 ] as
114+ | { body ?: { timeoutMs ?: number ; maxChars ?: number } }
115+ | undefined ;
116+ const options = mocks . callBrowserRequest . mock . calls . at ( - 1 ) ?. [ 2 ] as
117+ | { timeoutMs ?: number }
118+ | undefined ;
119+ expect ( request ?. body ?. timeoutMs ) . toBe ( operationTimeoutMs ) ;
120+ expect ( request ?. body ?. maxChars ) . toBe ( 100 ) ;
121+ expect ( options ?. timeoutMs ) . toBe ( requestTimeoutMs ) ;
122+ } ,
123+ ) ;
106124} ) ;
0 commit comments