diff options
author | Paul Frazee <pfrazee@gmail.com> | 2022-11-28 10:22:08 -0600 |
---|---|---|
committer | Paul Frazee <pfrazee@gmail.com> | 2022-11-28 10:22:08 -0600 |
commit | bcb1ad98de0ab2d2b184e030d8a7bcbb1e4e288b (patch) | |
tree | a19c7c054ce78d9a44169cbc68170faba216b67c /__tests__ | |
parent | 8723b51693f824fbd62218ab0789a76b34315904 (diff) | |
download | voidsky-bcb1ad98de0ab2d2b184e030d8a7bcbb1e4e288b.tar.zst |
Fix a couple incorrect link detections ('e.g.' and 'foo.jpg') (close #13)
Diffstat (limited to '__tests__')
-rw-r--r-- | __tests__/string-utils.ts | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/__tests__/string-utils.ts b/__tests__/string-utils.ts index c677b44d3..fc7a8f272 100644 --- a/__tests__/string-utils.ts +++ b/__tests__/string-utils.ts @@ -31,6 +31,11 @@ describe('extractEntities', () => { 'start middle end.com/foo/bar?baz=bux#hash', 'newline1.com\nnewline2.com', 'not.. a..url ..here', + 'e.g.', + 'something-cool.jpg', + 'website.com.jpg', + 'e.g./foo', + 'website.com.jpg/foo', ] interface Output { type: string @@ -80,6 +85,11 @@ describe('extractEntities', () => { {type: 'link', value: 'newline2.com', noScheme: true}, ], [], + [], + [], + [], + [], + [], ] it('correctly handles a set of text inputs', () => { for (let i = 0; i < inputs.length; i++) { @@ -145,6 +155,12 @@ describe('detectLinkables', () => { 'start middle end.com/foo/bar?baz=bux#hash', 'newline1.com\nnewline2.com', 'not.. a..url ..here', + 'e.g.', + 'e.g. real.com fake.notreal', + 'something-cool.jpg', + 'website.com.jpg', + 'e.g./foo', + 'website.com.jpg/foo', ] const outputs = [ ['no linkable'], @@ -171,6 +187,12 @@ describe('detectLinkables', () => { ['start middle ', {link: 'end.com/foo/bar?baz=bux#hash'}], [{link: 'newline1.com'}, '\n', {link: 'newline2.com'}], ['not.. a..url ..here'], + ['e.g.'], + ['e.g. ', {link: 'real.com'}, ' fake.notreal'], + ['something-cool.jpg'], + ['website.com.jpg'], + ['e.g./foo'], + ['website.com.jpg/foo'], ] it('correctly handles a set of text inputs', () => { for (let i = 0; i < inputs.length; i++) { |