fix: parseInternalLinks test (#1050)
This commit is contained in:
parent
6d57bbffe5
commit
255ad29897
|
@ -7,6 +7,8 @@ const cases = [
|
|||
['https://stacker.news/items/123/related', '#123/related'],
|
||||
// invalid links should not be parsed so user can spot error
|
||||
['https://stacker.news/items/123foobar', undefined],
|
||||
// Invalid origin should not be parsed so no malicious links
|
||||
['https://example.com/items/123', undefined],
|
||||
// parse referral links
|
||||
['https://stacker.news/items/123/r/ekzyis', '#123'],
|
||||
// use comment id if available
|
||||
|
@ -21,6 +23,7 @@ describe('internal links', () => {
|
|||
test.each(cases)(
|
||||
'parses %p as %p',
|
||||
(href, expected) => {
|
||||
process.env.NEXT_PUBLIC_URL = 'https://stacker.news'
|
||||
const actual = parseInternalLinks(href)
|
||||
expect(actual).toBe(expected)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue