Skip to content

Commit 763ddc8

Browse files
max-nextcloudbackportbot[bot]
authored andcommitted
test(links): add linkTo helper function
Signed-off-by: Max <max@nextcloud.com>
1 parent 451625d commit 763ddc8

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/tests/helpers/links.spec.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,19 @@ global._oc_webroot = ''
1515
describe('Preparing href attributes for the DOM', () => {
1616

1717
test('leave empty hrefs alone', () => {
18-
expect(domHref({attrs: {href: ''}})).toBe('')
18+
expect(linkTo('')).toBe('')
1919
})
2020

2121
test('leave undefined hrefs alone', () => {
2222
expect(domHref({attrs: {}})).toBe(undefined)
2323
})
2424

2525
test('full url', () => {
26-
expect(domHref({attrs: {href: 'https://otherdomain.tld'}}))
27-
.toBe('https://otherdomain.tld')
26+
expect(linkTo('https://otherdomain.tld')).toBe('https://otherdomain.tld')
2827
})
2928

30-
test('other protocol', () => {
31-
expect(domHref({attrs: {href: 'mailTo:test@mail.example'}}))
32-
.toBe('mailTo:test@mail.example')
29+
test('other protocols', () => {
30+
expect(linkTo('mailto:name@otherdomain.tld')).toBe('mailto:name@otherdomain.tld')
3331
})
3432

3533
test('relative link with fileid', () => {

0 commit comments

Comments
 (0)