fix(whatsapp): prevent merged lid conversations from returning
This commit is contained in:
@@ -3,6 +3,7 @@ import test from 'node:test'
|
||||
import {
|
||||
canonicalWhatsAppJid,
|
||||
isWeakWhatsAppDisplayName,
|
||||
resolvedWhatsAppJid,
|
||||
reusableWhatsAppConversations,
|
||||
whatsappCustomerStableId,
|
||||
} from '../src/whatsapp-identity.js'
|
||||
@@ -16,6 +17,14 @@ test('WhatsApp LID resolves to the same canonical phone identity', () => {
|
||||
assert.equal(canonicalWhatsAppJid('987654321@lid', { canonicalJid: '15551234567:0@s.whatsapp.net' }), phoneJid)
|
||||
})
|
||||
|
||||
test('a newly resolved phone identity overrides a stale cached LID', () => {
|
||||
const lid = '987654321@lid'
|
||||
const phoneJid = '15551234567@s.whatsapp.net'
|
||||
assert.equal(resolvedWhatsAppJid(lid, {}, lid), lid)
|
||||
assert.equal(resolvedWhatsAppJid(lid, { phone: '+1 555 123 4567' }, lid), phoneJid)
|
||||
assert.equal(resolvedWhatsAppJid(lid, {}, phoneJid), phoneJid)
|
||||
})
|
||||
|
||||
test('WhatsApp customer id remains stable after gateway reauthorization', () => {
|
||||
assert.equal(
|
||||
whatsappCustomerStableId('15551234567@s.whatsapp.net'),
|
||||
|
||||
Reference in New Issue
Block a user