@@ -456,6 +456,55 @@ describe('assemblies create', () => {
456456 expect ( await readFile ( outputPath , 'utf8' ) ) . toBe ( 'existing-bundle' )
457457 } )
458458
459+ it ( 'reruns single-input bundled assemblies when the input is newer than the output' , async ( ) => {
460+ vi . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } )
461+
462+ const tempDir = await createTempDir ( 'transloadit-bundle-single-input-stale-' )
463+ const inputPath = path . join ( tempDir , 'a.txt' )
464+ const outputPath = path . join ( tempDir , 'bundle.zip' )
465+
466+ await writeFile ( inputPath , 'a' )
467+ await writeFile ( outputPath , 'existing-bundle' )
468+
469+ const outputTime = new Date ( '2026-01-01T00:00:10.000Z' )
470+ const inputTime = new Date ( '2026-01-01T00:00:20.000Z' )
471+
472+ await utimes ( inputPath , inputTime , inputTime )
473+ await utimes ( outputPath , outputTime , outputTime )
474+
475+ const output = new OutputCtl ( )
476+ const client = {
477+ createAssembly : vi . fn ( ) . mockResolvedValue ( { assembly_id : 'assembly-single-input-stale' } ) ,
478+ awaitAssemblyCompletion : vi . fn ( ) . mockResolvedValue ( {
479+ ok : 'ASSEMBLY_COMPLETED' ,
480+ results : {
481+ compressed : [ { url : 'http://downloads.test/bundle-single.zip' , name : 'bundle.zip' } ] ,
482+ } ,
483+ } ) ,
484+ }
485+
486+ nock ( 'http://downloads.test' ) . get ( '/bundle-single.zip' ) . reply ( 200 , 'fresh-bundle' )
487+
488+ await create ( output , client as never , {
489+ inputs : [ inputPath ] ,
490+ output : outputPath ,
491+ singleAssembly : true ,
492+ stepsData : {
493+ compressed : {
494+ robot : '/file/compress' ,
495+ result : true ,
496+ use : {
497+ steps : [ ':original' ] ,
498+ bundle_steps : true ,
499+ } ,
500+ } ,
501+ } ,
502+ } )
503+
504+ expect ( client . createAssembly ) . toHaveBeenCalledTimes ( 1 )
505+ expect ( await readFile ( outputPath , 'utf8' ) ) . toBe ( 'fresh-bundle' )
506+ } )
507+
459508 it ( 'rewrites existing bundled outputs on single-assembly reruns' , async ( ) => {
460509 vi . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } )
461510
0 commit comments