@@ -345,22 +345,47 @@ describe("discordOutbound", () => {
345345 2 ,
346346 ) ;
347347 expect ( messageOptions . accountId ) . toBe ( "default" ) ;
348- expect ( messageOptions . replyTo ) . toBeUndefined ( ) ;
348+ expect ( messageOptions . replyTo ) . toBe ( "reply-1" ) ;
349349
350350 const mediaCall = mockCall ( hoisted . sendMessageDiscordMock , "sendMessageDiscord" , 1 ) ;
351351 expect ( mediaCall [ 0 ] ) . toBe ( "channel:123456" ) ;
352352 expect ( mediaCall [ 1 ] ) . toBe ( "" ) ;
353353 const mediaOptions = mockObjectArg ( hoisted . sendMessageDiscordMock , "sendMessageDiscord" , 1 , 2 ) ;
354354 expect ( mediaOptions . accountId ) . toBe ( "default" ) ;
355355 expect ( mediaOptions . mediaUrl ) . toBe ( "https://example.com/extra.png" ) ;
356- expect ( mediaOptions . replyTo ) . toBeUndefined ( ) ;
356+ expect ( mediaOptions . replyTo ) . toBe ( "reply-1" ) ;
357357 expect ( result ) . toEqual ( {
358358 channel : "discord" ,
359359 messageId : "msg-1" ,
360360 channelId : "ch-1" ,
361361 } ) ;
362362 } ) ;
363363
364+ it ( "keeps captured replyTo on audioAsVoice sends when replyToMode is batched" , async ( ) => {
365+ await discordOutbound . sendPayload ?.( {
366+ cfg : { } ,
367+ to : "channel:123456" ,
368+ text : "" ,
369+ payload : {
370+ text : "voice note" ,
371+ mediaUrls : [ "https://example.com/voice.ogg" , "https://example.com/extra.png" ] ,
372+ audioAsVoice : true ,
373+ } ,
374+ accountId : "default" ,
375+ replyToId : "reply-1" ,
376+ replyToMode : "batched" ,
377+ } ) ;
378+
379+ expect (
380+ mockObjectArg ( hoisted . sendVoiceMessageDiscordMock , "sendVoiceMessageDiscord" , 0 , 2 ) . replyTo ,
381+ ) . toBe ( "reply-1" ) ;
382+ expect (
383+ hoisted . sendMessageDiscordMock . mock . calls . map (
384+ ( call ) => ( call [ 2 ] as { replyTo ?: unknown } | undefined ) ?. replyTo ,
385+ ) ,
386+ ) . toEqual ( [ "reply-1" , "reply-1" ] ) ;
387+ } ) ;
388+
364389 it ( "keeps replyToId on every internal audioAsVoice send when replyToMode is all" , async ( ) => {
365390 await discordOutbound . sendPayload ?.( {
366391 cfg : { } ,
0 commit comments