@@ -36,7 +36,7 @@ describe("createMessageReceiptFromOutboundResults", () => {
3636 ] ) ;
3737 } ) ;
3838
39- it ( "uses alternate platform ids when messageId is unavailable " , ( ) => {
39+ it ( "uses legacy WhatsApp platform ids when no adapter receipt exists " , ( ) => {
4040 const receipt = createMessageReceiptFromOutboundResults ( {
4141 results : [ { channel : "whatsapp" , messageId : "" , toJid : "jid-1" } ] ,
4242 sentAt : 123 ,
@@ -46,6 +46,47 @@ describe("createMessageReceiptFromOutboundResults", () => {
4646 expect ( receipt . platformMessageIds ) . toEqual ( [ "jid-1" ] ) ;
4747 } ) ;
4848
49+ it . each ( [
50+ {
51+ label : "Synology Chat destination IDs" ,
52+ result : { channel : "synology-chat" , messageId : "" , chatId : "42" } ,
53+ receiptMetadata : { threadId : "42" } ,
54+ } ,
55+ {
56+ label : "iMessage bridge placeholders" ,
57+ result : { channel : "imessage" , messageId : "ok" } ,
58+ receiptMetadata : { replyToId : "source-1" } ,
59+ } ,
60+ {
61+ label : "Slack suppression sentinels" ,
62+ result : { channel : "slack" , messageId : "suppressed" , channelId : "" } ,
63+ receiptMetadata : { } ,
64+ } ,
65+ {
66+ label : "Twitch skip sentinels" ,
67+ result : { channel : "twitch" , messageId : "skipped" } ,
68+ receiptMetadata : { } ,
69+ } ,
70+ ] ) ( "does not fabricate platform ids from $label" , ( { result, receiptMetadata } ) => {
71+ const adapterReceipt = {
72+ platformMessageIds : [ ] ,
73+ parts : [ ] ,
74+ sentAt : 123 ,
75+ ...receiptMetadata ,
76+ } ;
77+ const receipt = createMessageReceiptFromOutboundResults ( {
78+ results : [ { ...result , receipt : adapterReceipt } ] ,
79+ } ) ;
80+
81+ expect ( receipt ) . toMatchObject ( {
82+ ...receiptMetadata ,
83+ platformMessageIds : [ ] ,
84+ parts : [ ] ,
85+ sentAt : 123 ,
86+ } ) ;
87+ expect ( receipt . primaryPlatformMessageId ) . toBeUndefined ( ) ;
88+ } ) ;
89+
4990 it ( "preserves nested platform receipts before falling back to delivery ids" , ( ) => {
5091 const receipt = createMessageReceiptFromOutboundResults ( {
5192 results : [
0 commit comments