Better emoji support in linkify/previews

This commit is contained in:
Fedor Indutny 2021-06-30 10:00:02 -07:00 committed by GitHub
parent 65ad608aa7
commit 773aa9af19
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 337 additions and 260 deletions

View file

@ -7,7 +7,7 @@ const {
findLinks,
isLinkSafeToPreview,
isLinkSneaky,
} = require('../../js/modules/link_previews');
} = require('../../ts/types/LinkPreview');
describe('Link previews', () => {
describe('#isLinkSafeToPreview', () => {
@ -54,6 +54,15 @@ describe('Link previews', () => {
assert.deepEqual(expected, actual);
});
it('returns all links after emojis without spaces in between', () => {
const text = '😎https://github.com/signalapp/Signal-Desktop😛';
const expected = ['https://github.com/signalapp/Signal-Desktop'];
const actual = findLinks(text);
assert.deepEqual(expected, actual);
});
it('includes all links if cursor is not in a link', () => {
const text =
'Check out this link: https://github.com/signalapp/Signal-Desktop\nAnd this one too: https://github.com/signalapp/Signal-Android';