@@ -778,11 +778,16 @@ describe("mobile composer drafts", () => {
778778 sizeBytes : 4 ,
779779 fileUri : "file:///clip.mp4" ,
780780 } ;
781+ const videoCleanup = Promise . withResolvers < void > ( ) ;
782+ composerAttachmentCleanupMocks . remove . mockImplementationOnce ( async ( ) => {
783+ videoCleanup . resolve ( ) ;
784+ } ) ;
781785 expect ( appendComposerDraftAttachments ( key , [ image , video ] , { appendReference : true } ) ) . toBe ( 1 ) ;
782786 expect ( getComposerDraftSnapshot ( key ) ) . toEqual ( { ...before , attachments : [ image ] } ) ;
787+ await videoCleanup . promise ;
783788 } ) ;
784789
785- it ( "fills images only into slots left after file chips replace the selection" , ( ) => {
790+ it ( "fills images only into slots left after file chips replace the selection" , async ( ) => {
786791 const key = "environment-1:replace-at-limit" ;
787792 const file = ( id : string ) => ( {
788793 id,
@@ -803,6 +808,12 @@ describe("mobile composer drafts", () => {
803808 appendComposerDraftAttachments ( key , [ file ( "old" ) ] , { appendReference : true } ) ;
804809 const { text } = getComposerDraftSnapshot ( key ) ;
805810 const insertion = captureComposerDraftInsertion ( key , { start : 0 , end : text . length } ) ;
811+ const outboxLoad = vi . spyOn ( threadOutboxManager , "load" ) . mockResolvedValue ( true ) ;
812+ onTestFinished ( ( ) => outboxLoad . mockRestore ( ) ) ;
813+ const cleanup = Promise . withResolvers < void > ( ) ;
814+ composerAttachmentCleanupMocks . remove . mockImplementationOnce ( async ( ) => {
815+ cleanup . resolve ( ) ;
816+ } ) ;
806817 expect (
807818 appendComposerDraftAttachments ( key , [ image , file ( "new" ) ] , {
808819 appendReference : true ,
@@ -811,6 +822,7 @@ describe("mobile composer drafts", () => {
811822 } ) ,
812823 ) . toBe ( 1 ) ;
813824 expect ( getComposerDraftSnapshot ( key ) . attachments ) . toEqual ( [ file ( "new" ) ] ) ;
825+ await cleanup . promise ;
814826 } ) ;
815827 it . each ( [ "environment-1:thread" , "environment-1:new-task:draft" ] ) (
816828 "preserves the captured paste selection across async writes in %s" ,
0 commit comments