@@ -2318,13 +2318,15 @@ describe("mobile composer drafts", () => {
23182318 fileUri : "file:///documents/backup.json" ,
23192319 } ;
23202320
2321- const merged = mergeComposerDraftContentState ( { } , draftKey , {
2322- text : "" ,
2323- attachments : [ sharedFile ] ,
2324- sourceShareId : "share-1" ,
2325- } ) [ draftKey ] ! ;
2321+ const existingFile = { ...sharedFile , id : "existing-file" , name : "notes.txt" } ;
2322+
2323+ const merged = mergeComposerDraftContentState (
2324+ { [ draftKey ] : { text : "" , attachments : [ existingFile ] } } ,
2325+ draftKey ,
2326+ { text : "" , attachments : [ sharedFile ] , sourceShareId : "share-1" } ,
2327+ ) [ draftKey ] ! ;
23262328
2327- expect ( merged . attachments ) . toEqual ( [ sharedFile ] ) ;
2329+ expect ( merged . attachments ) . toEqual ( [ existingFile , sharedFile ] ) ;
23282330 const references = collectComposerContextReferences ( merged . text ) ;
23292331 expect ( references ) . toHaveLength ( 1 ) ;
23302332 expect ( merged . context ?. records ) . toEqual ( [
@@ -2334,6 +2336,13 @@ describe("mobile composer drafts", () => {
23342336 attachmentId : sharedFile . id ,
23352337 } ) ,
23362338 ] ) ;
2339+
2340+ // A recovery merge carries its own text; a chip appended to it would
2341+ // break the duplicate-text check when the merge is retried.
2342+ const recovered = { text : "Retry this" , attachments : [ sharedFile ] } ;
2343+ const once = mergeComposerDraftContentState ( { } , draftKey , recovered ) ;
2344+ expect ( once [ draftKey ] ?. text ) . toBe ( "Retry this" ) ;
2345+ expect ( mergeComposerDraftContentState ( once , draftKey , recovered ) ) . toBe ( once ) ;
23372346 } ) ;
23382347
23392348 it ( "preserves existing images when shared content exceeds the draft attachment limit" , ( ) => {
0 commit comments