Skip to content

Commit

Permalink
Add comments to test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
ekzyis committed Feb 14, 2025
1 parent cb8cb12 commit 2222c8f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/url.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,19 @@ describe('internal links', () => {
})

const misleadingLinkCases = [
// if text is the same as the link, it's not misleading
['https://stacker.news/items/1234', 'https://stacker.news/items/1234', false],
// same origin is not misleading
['https://stacker.news/items/1235', 'https://stacker.news/items/1234', false],
['www.google.com', 'https://www.google.com', false],
['stacker.news', 'https://stacker.news', false],
// if text is obviously not a link, it's not misleading
['innocent text', 'https://stacker.news/items/1234', false],
['innocenttext', 'https://stacker.news/items/1234', false],
// if text might be a link to a different origin, it's misleading
['innocent.text', 'https://stacker.news/items/1234', true],
['https://stacker.news/items/1235', 'https://stacker.news/items/1234', false],
['https://google.com', 'https://bing.com', true],
['www.google.com', 'https://bing.com', true],
['www.google.com', 'https://www.google.com', false],
['stacker.news', 'https://stacker.news', false]
['www.google.com', 'https://bing.com', true]
]

describe('misleading links', () => {
Expand Down

0 comments on commit 2222c8f

Please sign in to comment.