1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-12-24 13:09:23 -05:00

[TESTS] Add some Wiki unit tests

- Just to get 100% coverage on services/wiki/wiki_path.go, nothing
special. This is just an formality.
This commit is contained in:
Gusted 2023-07-29 23:30:25 +02:00
parent 0dd070d5c8
commit cf3f046d7a
No known key found for this signature in database
GPG key ID: FD821B732837125F

View file

@ -307,3 +307,15 @@ func TestPrepareWikiFileName_FirstPage(t *testing.T) {
assert.NoError(t, err)
assert.EqualValues(t, "Home.md", newWikiPath)
}
func TestWebPathConversion(t *testing.T) {
assert.Equal(t, "path/wiki", WebPathToURLPath(WebPath("path/wiki")))
assert.Equal(t, "wiki", WebPathToURLPath(WebPath("wiki")))
assert.Equal(t, "", WebPathToURLPath(WebPath("")))
}
func TestWebPathFromRequest(t *testing.T) {
assert.Equal(t, WebPath("a%2Fb"), WebPathFromRequest("a/b"))
assert.Equal(t, WebPath("a"), WebPathFromRequest("a"))
assert.Equal(t, WebPath("b"), WebPathFromRequest("a/../b"))
}