@@ -9,6 +9,12 @@ import legacyDownload from "js-file-download";
99
1010vi . mock ( "js-file-download" ) ;
1111
12+ // Make delay a no-op so sequential downloads complete instantly in tests
13+ vi . mock ( "shared/tools" , async ( importOriginal ) => ( {
14+ ...( await importOriginal < typeof import ( "shared/tools" ) > ( ) ) ,
15+ delay : ( ) => Promise . resolve ( ) ,
16+ } ) ) ;
17+
1218// Mock environment
1319vi . mock ( "shared/environment" , ( ) => ( {
1420 default : {
@@ -335,18 +341,15 @@ describe("<BackupCreateFlow /> sequential individual download", () => {
335341 fireEvent . click ( screen . getByRole ( "button" , { name : / c r e a t e b a c k u p / i } ) ) ;
336342
337343 // All 11 files should be downloaded. Chromium blocks simultaneous
338- // programmatic downloads above ~10; the sequential approach (one every
339- // 200ms) avoids that entirely. 11 files → ~2200ms total.
340- await waitFor (
341- ( ) => {
342- expect ( downloadedFiles ) . toHaveLength ( modelCount ) ;
343- } ,
344- { timeout : 5000 }
345- ) ;
344+ // programmatic downloads above ~10; the sequential approach (one per
345+ // 200ms in production, instant in tests) avoids that entirely.
346+ await waitFor ( ( ) => {
347+ expect ( downloadedFiles ) . toHaveLength ( modelCount ) ;
348+ } ) ;
346349
347350 // Verify each model file was included
348351 modelNames . forEach ( ( name ) => {
349352 expect ( downloadedFiles ) . toContain ( `${ name } .yml` ) ;
350353 } ) ;
351- } , 15000 ) ; // 11 files × 200ms = ~2200ms, plus test overhead
354+ } ) ;
352355} ) ;
0 commit comments