@@ -328,17 +328,27 @@ describe('File Parse API Route', () => {
328328 expect ( data . results ) . toHaveLength ( 2 )
329329 } )
330330
331- it ( 'should cap remaining download size while processing multi-file parse results ' , async ( ) => {
331+ it ( 'should keep the multi-file download cap independent from the remaining parsed-output cap ' , async ( ) => {
332332 inputValidationMockFns . mockValidateUrlWithDNS . mockResolvedValue ( {
333333 isValid : true ,
334334 resolvedIP : '203.0.113.10' ,
335335 } )
336- inputValidationMockFns . mockSecureFetchWithPinnedIP . mockResolvedValue (
337- new Response ( 'file content' , {
338- status : 200 ,
339- headers : { 'content-type' : 'text/plain' } ,
340- } )
341- )
336+ inputValidationMockFns . mockSecureFetchWithPinnedIP
337+ . mockResolvedValueOnce (
338+ new Response ( 'file content' , {
339+ status : 200 ,
340+ headers : { 'content-type' : 'text/plain' } ,
341+ } )
342+ )
343+ . mockResolvedValueOnce (
344+ new Response ( 'second file content' , {
345+ status : 200 ,
346+ headers : {
347+ 'content-length' : String ( 20 * 1024 * 1024 ) ,
348+ 'content-type' : 'text/plain' ,
349+ } ,
350+ } )
351+ )
342352
343353 const fourMbContent = 'a' . repeat ( 4 * 1024 * 1024 )
344354 mockParseBuffer
@@ -364,17 +374,17 @@ describe('File Parse API Route', () => {
364374 1 ,
365375 'https://example.com/file1.txt' ,
366376 '203.0.113.10' ,
367- expect . objectContaining ( { maxResponseBytes : 5 * 1024 * 1024 } )
377+ expect . objectContaining ( { maxResponseBytes : 100 * 1024 * 1024 } )
368378 )
369379 expect ( inputValidationMockFns . mockSecureFetchWithPinnedIP ) . toHaveBeenNthCalledWith (
370380 2 ,
371381 'https://example.com/file2.txt' ,
372382 '203.0.113.10' ,
373- expect . objectContaining ( { maxResponseBytes : 1024 * 1024 } )
383+ expect . objectContaining ( { maxResponseBytes : 100 * 1024 * 1024 } )
374384 )
375385 } )
376386
377- it ( 'should preserve the remaining multi-file cap when an external URL reuses a workspace file' , async ( ) => {
387+ it ( 'should preserve the full download cap when an external URL reuses a workspace file' , async ( ) => {
378388 inputValidationMockFns . mockValidateUrlWithDNS . mockResolvedValue ( {
379389 isValid : true ,
380390 resolvedIP : '203.0.113.10' ,
@@ -411,7 +421,7 @@ describe('File Parse API Route', () => {
411421 expect ( response . status ) . toBe ( 200 )
412422 expect ( data . results ) . toHaveLength ( 2 )
413423 expect ( storageServiceMockFns . mockDownloadFile ) . toHaveBeenCalledWith (
414- expect . objectContaining ( { key : 'workspace-file2.txt' , maxBytes : 1024 * 1024 } )
424+ expect . objectContaining ( { key : 'workspace-file2.txt' , maxBytes : 100 * 1024 * 1024 } )
415425 )
416426 } )
417427
0 commit comments