Skip to content

Commit

Permalink
fix(md-hyperlink-regex): Added additional test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
mananjadhav committed Aug 17, 2021
1 parent 6424b46 commit 11018de
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions __tests__/ExpensiMark-HTML-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,14 @@ test('Test markdown and url links with inconsistent starting and closing parens'
+ '[Yo click here to see a cool cat)](https://c8.alamy.com/compes/ha11pc/cookie-cat-con-sombrero-de-cowboy-y-sun-glass-ha11pc.jpg) '
+ '[Yo (click here to see a cool cat](https://c8.alamy.com/compes/ha11pc/cookie-cat-con-sombrero-de-cowboy-y-sun-glass-ha11pc.jpg) '
+ '[Yo click * $ & here to see a cool cat](https://c8.alamy.com/compes/ha11pc/cookie-cat-con-sombrero-de-cowboy-y-sun-glass-ha11pc.jpg) '
+ '[Text text] more text ([link here](www.google.com))';
+ '[Text text] more text ([link here](www.google.com))'
+ '[Text text] more text ([link [square brackets within] here](www.google.com))'
+ '[Text text] more text ([link (parenthesis within) here](www.google.com))'
+ '[Text text] more text [link here](www.google.com)'
+ '[Text text] more text ([link here ](www.google.com))'
+ '[Text text] more text (([link here](www.google.com)))'
+ '[Text text] more text [([link here](www.google.com))]'
+ '[Text text] more text ([link here](www.google.com))[Text text] more text ([link here](www.google.com))';


const resultString = '<a href="http://google.com/(something)?after=parens" target="_blank">google</a> '
Expand All @@ -355,7 +362,14 @@ test('Test markdown and url links with inconsistent starting and closing parens'
+ '<a href="https://c8.alamy.com/compes/ha11pc/cookie-cat-con-sombrero-de-cowboy-y-sun-glass-ha11pc.jpg" target="_blank">Yo click here to see a cool cat)</a> '
+ '<a href="https://c8.alamy.com/compes/ha11pc/cookie-cat-con-sombrero-de-cowboy-y-sun-glass-ha11pc.jpg" target="_blank">Yo (click here to see a cool cat</a> '
+ '<a href="https://c8.alamy.com/compes/ha11pc/cookie-cat-con-sombrero-de-cowboy-y-sun-glass-ha11pc.jpg" target="_blank">Yo click * $ &amp; here to see a cool cat</a> '
+ '[Text text] more text (<a href="http://www.google.com" target="_blank">link here</a>)';
+ '[Text text] more text (<a href="http://www.google.com" target="_blank">link here</a>)'
+ '[Text text] more text (<a href="http://www.google.com" target="_blank">link [square brackets within] here</a>)'
+ '[Text text] more text (<a href="http://www.google.com" target="_blank">link (parenthesis within) here</a>)'
+ '[Text text] more text <a href="http://www.google.com" target="_blank">link here</a>'
+ '[Text text] more text (<a href="http://www.google.com" target="_blank">link here </a>)'
+ '[Text text] more text ((<a href="http://www.google.com" target="_blank">link here</a>))'
+ '[Text text] more text [(<a href="http://www.google.com" target="_blank">link here</a>)]'
+ '[Text text] more text (<a href="http://www.google.com" target="_blank">link here</a>)[Text text] more text (<a href="http://www.google.com" target="_blank">link here</a>)'


expect(parser.replace(testString)).toBe(resultString);
Expand Down

0 comments on commit 11018de

Please sign in to comment.