Skip to content

Commit e5a643a

Browse files
committed
test(shared): tweak isLinkExternal test cases
1 parent 460f39b commit e5a643a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/@vuepress/shared/__tests__/utils/isLinkExternal.spec.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,22 @@ const testCases: [
44
Parameters<typeof isLinkExternal>,
55
ReturnType<typeof isLinkExternal>
66
][] = [
7+
// with default base `/`
78
[['https://foobar.com'], true],
89
[['http://foobar.com'], true],
910
[['//foobar.com'], true],
1011
[['foobar.com'], false],
1112
[['/foo/bar'], false],
13+
[['foo/bar'], false],
14+
[['../foo/bar'], false],
15+
16+
// with base `/base/`
1217
[['/foo/bar', '/base/'], true],
18+
[['foo/bar', '/base/'], false],
19+
[['../foo/bar', '/base/'], false],
1320
[['/base/foo/bar', '/base/'], false],
1421
[['mailto:foobar', '/base/'], false],
1522
[['tel:foobar', '/base/'], false],
16-
[['../foo/bar', '/base/'], false],
1723
]
1824

1925
describe('shared > isLinkExternal', () => {

0 commit comments

Comments
 (0)