@@ -378,7 +378,7 @@ describe("CliManager", () => {
378378 expect . objectContaining ( {
379379 responseType : "stream" ,
380380 headers : expect . objectContaining ( {
381- "Accept-Encoding" : "gzip " ,
381+ "Accept-Encoding" : "identity " ,
382382 "If-None-Match" : '""' ,
383383 } ) ,
384384 } ) ,
@@ -393,7 +393,7 @@ describe("CliManager", () => {
393393 "/custom/path" ,
394394 expect . objectContaining ( {
395395 responseType : "stream" ,
396- decompress : true ,
396+ decompress : false ,
397397 validateStatus : expect . any ( Function ) ,
398398 } ) ,
399399 ) ;
@@ -528,10 +528,33 @@ describe("CliManager", () => {
528528
529529 it ( "handles missing content-length" , async ( ) => {
530530 withSuccessfulDownload ( { headers : { } } ) ;
531+ mockProgress . clearProgressReports ( ) ;
531532 const result = await manager . fetchBinary ( mockApi , "test" ) ;
532533 expectPathsEqual ( result , BINARY_PATH ) ;
533534 expect ( memfs . existsSync ( BINARY_PATH ) ) . toBe ( true ) ;
534- } ) ;
535+ // Without any content-length header, increment should be undefined.
536+ const reports = mockProgress . getProgressReports ( ) ;
537+ expect ( reports ) . not . toHaveLength ( 0 ) ;
538+ for ( const report of reports ) {
539+ expect ( report ) . toMatchObject ( { increment : undefined } ) ;
540+ }
541+ } ) ;
542+
543+ it . each ( [ "content-length" , "x-original-content-length" ] ) (
544+ "reports progress with %s header" ,
545+ async ( header ) => {
546+ withSuccessfulDownload ( { headers : { [ header ] : "1024" } } ) ;
547+ mockProgress . clearProgressReports ( ) ;
548+ const result = await manager . fetchBinary ( mockApi , "test" ) ;
549+ expectPathsEqual ( result , BINARY_PATH ) ;
550+ expect ( memfs . existsSync ( BINARY_PATH ) ) . toBe ( true ) ;
551+ const reports = mockProgress . getProgressReports ( ) ;
552+ expect ( reports ) . not . toHaveLength ( 0 ) ;
553+ for ( const report of reports ) {
554+ expect ( report ) . toMatchObject ( { increment : expect . any ( Number ) } ) ;
555+ }
556+ } ,
557+ ) ;
535558 } ) ;
536559
537560 describe ( "Download Progress Tracking" , ( ) => {
@@ -543,7 +566,9 @@ describe("CliManager", () => {
543566 withSuccessfulDownload ( ) ;
544567 await manager . fetchBinary ( mockApi , "test" ) ;
545568 expect ( vscode . window . withProgress ) . toHaveBeenCalledWith (
546- expect . objectContaining ( { title : `Downloading ${ TEST_URL } ` } ) ,
569+ expect . objectContaining ( {
570+ title : `Downloading Coder CLI for ${ TEST_URL } ` ,
571+ } ) ,
547572 expect . any ( Function ) ,
548573 ) ;
549574 } ) ;
0 commit comments