@@ -776,11 +776,16 @@ describe("mobile composer drafts", () => {
776776 sizeBytes : 4 ,
777777 fileUri : "file:///clip.mp4" ,
778778 } ;
779+ const videoCleanup = Promise . withResolvers < void > ( ) ;
780+ composerAttachmentCleanupMocks . remove . mockImplementationOnce ( async ( ) => {
781+ videoCleanup . resolve ( ) ;
782+ } ) ;
779783 expect ( appendComposerDraftAttachments ( key , [ image , video ] , { appendReference : true } ) ) . toBe ( 1 ) ;
780784 expect ( getComposerDraftSnapshot ( key ) ) . toEqual ( { ...before , attachments : [ image ] } ) ;
785+ await videoCleanup . promise ;
781786 } ) ;
782787
783- it ( "fills images only into slots left after file chips replace the selection" , ( ) => {
788+ it ( "fills images only into slots left after file chips replace the selection" , async ( ) => {
784789 const key = "environment-1:replace-at-limit" ;
785790 const file = ( id : string ) => ( {
786791 id,
@@ -801,6 +806,12 @@ describe("mobile composer drafts", () => {
801806 appendComposerDraftAttachments ( key , [ file ( "old" ) ] , { appendReference : true } ) ;
802807 const { text } = getComposerDraftSnapshot ( key ) ;
803808 const insertion = captureComposerDraftInsertion ( key , { start : 0 , end : text . length } ) ;
809+ const outboxLoad = vi . spyOn ( threadOutboxManager , "load" ) . mockResolvedValue ( true ) ;
810+ onTestFinished ( ( ) => outboxLoad . mockRestore ( ) ) ;
811+ const cleanup = Promise . withResolvers < void > ( ) ;
812+ composerAttachmentCleanupMocks . remove . mockImplementationOnce ( async ( ) => {
813+ cleanup . resolve ( ) ;
814+ } ) ;
804815 expect (
805816 appendComposerDraftAttachments ( key , [ image , file ( "new" ) ] , {
806817 appendReference : true ,
@@ -809,6 +820,7 @@ describe("mobile composer drafts", () => {
809820 } ) ,
810821 ) . toBe ( 1 ) ;
811822 expect ( getComposerDraftSnapshot ( key ) . attachments ) . toEqual ( [ file ( "new" ) ] ) ;
823+ await cleanup . promise ;
812824 } ) ;
813825 it . each ( [ "environment-1:thread" , "environment-1:new-task:draft" ] ) (
814826 "preserves the captured paste selection across async writes in %s" ,
0 commit comments