From 084e3c8341b49455352494f5e556b7147ed54cbd Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Fri, 20 Sep 2024 11:46:14 -0500 Subject: [PATCH] note: test that mentions with commas get parsed correctly --- src/utils/note.test.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/utils/note.test.ts b/src/utils/note.test.ts index e8d17e89..699c4c5e 100644 --- a/src/utils/note.test.ts +++ b/src/utils/note.test.ts @@ -36,6 +36,27 @@ Deno.test('parseNoteContent parses mentions with apostrophes', () => { ); }); +Deno.test('parseNoteContent parses mentions with commas', () => { + const { html } = parseNoteContent( + `Sim. Hi nostr:npub1q3sle0kvfsehgsuexttt3ugjd8xdklxfwwkh559wxckmzddywnws6cd26p and nostr:npub1gujeqakgt7fyp6zjggxhyy7ft623qtcaay5lkc8n8gkry4cvnrzqd3f67z, any chance to have Cobrafuma as PWA?`, + [{ + id: '0461fcbecc4c3374439932d6b8f11269ccdb7cc973ad7a50ae362db135a474dd', + username: 'alex', + acct: 'alex@gleasonator.dev', + url: 'https://gleasonator.dev/@alex', + }, { + id: '47259076c85f9240e852420d7213c95e95102f1de929fb60f33a2c32570c98c4', + username: 'patrick', + acct: 'patrick@patrickdosreis.com', + url: 'https://gleasonator.dev/@patrick@patrickdosreis.com', + }], + ); + assertEquals( + html, + 'Sim. Hi @alex@gleasonator.dev and @patrick@patrickdosreis.com, any chance to have Cobrafuma as PWA?', + ); +}); + Deno.test("parseNoteContent doesn't parse invalid nostr URIs", () => { const { html } = parseNoteContent('nip19 has URIs like nostr:npub and nostr:nevent, etc.', []); assertEquals(html, 'nip19 has URIs like nostr:npub and nostr:nevent, etc.');