@@ -2,7 +2,7 @@ import { describe, expect, it } from 'vitest'
22import { normalizeRoutePath } from '../src/index.js'
33
44const testCases = [
5- // index
5+ // absolute index
66 [ '/' , '/' ] ,
77 [ '/README.md' , '/' ] ,
88 [ '/readme.md' , '/' ] ,
@@ -15,37 +15,37 @@ const testCases = [
1515 [ '/foo/index.md' , '/foo/' ] ,
1616 [ '/foo/index.html' , '/foo/' ] ,
1717 [ '/foo/index' , '/foo/' ] ,
18- [ '' , '' ] ,
1918 [ 'README.md' , 'index.html' ] ,
2019 [ 'readme.md' , 'index.html' ] ,
2120 [ 'index.md' , 'index.html' ] ,
2221 [ 'index.html' , 'index.html' ] ,
2322 [ '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/' ] ,
3023
31- // non-index
24+ // absolute non-index
3225 [ '/foo' , '/foo.html' ] ,
3326 [ '/foo.md' , '/foo.html' ] ,
3427 [ '/foo.html' , '/foo.html' ] ,
3528 [ '/foo/bar' , '/foo/bar.html' ] ,
3629 [ '/foo/bar.md' , '/foo/bar.html' ] ,
3730 [ '/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
3841 [ 'foo' , 'foo.html' ] ,
3942 [ 'foo.md' , 'foo.html' ] ,
4043 [ 'foo.html' , 'foo.html' ] ,
4144 [ 'foo/bar' , 'foo/bar.html' ] ,
4245 [ 'foo/bar.md' , 'foo/bar.html' ] ,
4346 [ 'foo/bar.html' , 'foo/bar.html' ] ,
4447
45- // only hash and query
46- [ '' , '' ] ,
47-
48- // relative non index
48+ // relative non index with current
4949 [ 'foo' , '/foo.html' , '/' ] ,
5050 [ 'foo' , '/foo.html' , '/a.html' ] ,
5151 [ 'foo' , '/foo.html' , '/index.html' ] ,
@@ -137,7 +137,7 @@ const testCases = [
137137 [ '../foo/bar.html' , '/foo/bar.html' , '/a/index.html' ] ,
138138 [ '../foo/bar.html' , '/foo/bar.html' , '/a/b.html' ] ,
139139
140- // absolute non index
140+ // absolute non index with current
141141 [ '/foo' , '/foo.html' , '/' ] ,
142142 [ '/foo' , '/foo.html' , '/a.html' ] ,
143143 [ '/foo' , '/foo.html' , '/index.html' ] ,
@@ -175,6 +175,9 @@ const testCases = [
175175 [ '/foo/bar.html' , '/foo/bar.html' , '/a/index.html' ] ,
176176 [ '/foo/bar.html' , '/foo/bar.html' , '/a/b.html' ] ,
177177
178+ // only hash and query
179+ [ '' , '' ] ,
180+
178181 // unexpected corner cases
179182 [ '.md' , '.html' ] ,
180183 [ 'foo/.md' , 'foo/.html' ] ,
0 commit comments