@@ -2,7 +2,7 @@ import { describe, expect, it } from 'vitest'
2
2
import { normalizeRoutePath } from '../src/index.js'
3
3
4
4
const testCases = [
5
- // index
5
+ // absolute index
6
6
[ '/' , '/' ] ,
7
7
[ '/README.md' , '/' ] ,
8
8
[ '/readme.md' , '/' ] ,
@@ -15,37 +15,37 @@ const testCases = [
15
15
[ '/foo/index.md' , '/foo/' ] ,
16
16
[ '/foo/index.html' , '/foo/' ] ,
17
17
[ '/foo/index' , '/foo/' ] ,
18
- [ '' , '' ] ,
19
18
[ 'README.md' , 'index.html' ] ,
20
19
[ 'readme.md' , 'index.html' ] ,
21
20
[ 'index.md' , 'index.html' ] ,
22
21
[ 'index.html' , 'index.html' ] ,
23
22
[ 'index' , 'index.html' ] ,
24
- [ 'foo/' , 'foo/' ] ,
25
- [ 'foo/README.md' , 'foo/' ] ,
26
- [ 'foo/readme.md' , 'foo/' ] ,
27
- [ 'foo/index.md' , 'foo/' ] ,
28
- [ 'foo/index.html' , 'foo/' ] ,
29
- [ 'foo/index' , 'foo/' ] ,
30
23
31
- // non-index
24
+ // absolute non-index
32
25
[ '/foo' , '/foo.html' ] ,
33
26
[ '/foo.md' , '/foo.html' ] ,
34
27
[ '/foo.html' , '/foo.html' ] ,
35
28
[ '/foo/bar' , '/foo/bar.html' ] ,
36
29
[ '/foo/bar.md' , '/foo/bar.html' ] ,
37
30
[ '/foo/bar.html' , '/foo/bar.html' ] ,
31
+
32
+ // relative index without current
33
+ [ 'foo/' , 'foo/' ] ,
34
+ [ 'foo/README.md' , 'foo/' ] ,
35
+ [ 'foo/readme.md' , 'foo/' ] ,
36
+ [ 'foo/index.md' , 'foo/' ] ,
37
+ [ 'foo/index.html' , 'foo/' ] ,
38
+ [ 'foo/index' , 'foo/' ] ,
39
+
40
+ // relative non index without current
38
41
[ 'foo' , 'foo.html' ] ,
39
42
[ 'foo.md' , 'foo.html' ] ,
40
43
[ 'foo.html' , 'foo.html' ] ,
41
44
[ 'foo/bar' , 'foo/bar.html' ] ,
42
45
[ 'foo/bar.md' , 'foo/bar.html' ] ,
43
46
[ 'foo/bar.html' , 'foo/bar.html' ] ,
44
47
45
- // only hash and query
46
- [ '' , '' ] ,
47
-
48
- // relative non index
48
+ // relative non index with current
49
49
[ 'foo' , '/foo.html' , '/' ] ,
50
50
[ 'foo' , '/foo.html' , '/a.html' ] ,
51
51
[ 'foo' , '/foo.html' , '/index.html' ] ,
@@ -137,7 +137,7 @@ const testCases = [
137
137
[ '../foo/bar.html' , '/foo/bar.html' , '/a/index.html' ] ,
138
138
[ '../foo/bar.html' , '/foo/bar.html' , '/a/b.html' ] ,
139
139
140
- // absolute non index
140
+ // absolute non index with current
141
141
[ '/foo' , '/foo.html' , '/' ] ,
142
142
[ '/foo' , '/foo.html' , '/a.html' ] ,
143
143
[ '/foo' , '/foo.html' , '/index.html' ] ,
@@ -175,6 +175,9 @@ const testCases = [
175
175
[ '/foo/bar.html' , '/foo/bar.html' , '/a/index.html' ] ,
176
176
[ '/foo/bar.html' , '/foo/bar.html' , '/a/b.html' ] ,
177
177
178
+ // only hash and query
179
+ [ '' , '' ] ,
180
+
178
181
// unexpected corner cases
179
182
[ '.md' , '.html' ] ,
180
183
[ 'foo/.md' , 'foo/.html' ] ,
0 commit comments