@@ -16,11 +16,25 @@ describe("resolveWhatsAppOutboundMentions", () => {
1616 } ) ;
1717 } ) ;
1818
19- it ( "rewrites phone-number tokens to LID mention text without device suffixes" , ( ) => {
19+ it . each ( [
20+ { text : "ping @+5511976136970" , expected : "ping @277038292303944" } ,
21+ {
22+ text : "literal \\` ping @+5511976136970" ,
23+ expected : "literal \\` ping @277038292303944" ,
24+ } ,
25+ {
26+ text : "literal \\\\\\` ping @+5511976136970" ,
27+ expected : "literal \\\\\\` ping @277038292303944" ,
28+ } ,
29+ {
30+ text : "inside ``notify ` @+5511976136970`` then @+5511976136970" ,
31+ expected : "inside ``notify ` @+5511976136970`` then @277038292303944" ,
32+ } ,
33+ ] ) ( "rewrites visible phone-number mentions to LIDs: $text" , ( { text, expected } ) => {
2034 expect (
2135 resolveWhatsAppOutboundMentions ( {
223623- text : "ping @+5511976136970" ,
37+ text,
2438 participants : [
2539 {
2640 id : "277038292303944:2@lid" ,
@@ -29,7 +43,7 @@ describe("resolveWhatsAppOutboundMentions", () => {
2943 ] ,
3044 } ) ,
3145 ) . toEqual ( {
32- text : "ping @277038292303944" ,
46+ text : expected ,
3347 mentionedJids : [ "277038292303944@lid" ] ,
3448 } ) ;
3549 } ) ;
@@ -115,8 +129,14 @@ describe("resolveWhatsAppOutboundMentions", () => {
115129 } ) ;
116130 } ) ;
117131
118- it . each ( [ "Run `notify @+5511976136970" , "Run `notify\n@+5511976136970" ] ) (
119- "does not rewrite or mention phone numbers inside unterminated inline code: %j" ,
132+ it . each ( [
133+ "Run `notify @+5511976136970" ,
134+ "Run `notify\n@+5511976136970" ,
135+ "Run ``notify ` @+5511976136970" ,
136+ "Run ``notify ` @+5511976136970``" ,
137+ "literal \\\\` inside @+5511976136970" ,
138+ ] ) (
139+ "does not rewrite or mention phone numbers inside balanced or unterminated inline code: %j" ,
120140 ( text ) => {
121141 expect (
122142 resolveWhatsAppOutboundMentions ( {
0 commit comments