Skip to content

Commit

Permalink
Improve wiki user title test (#24559)
Browse files Browse the repository at this point in the history
The `..` should be covered by TestUserTitleToWebPath.

Otherwise, if the random string is "..", it causes unnecessary failure
in TestUserWebGitPathConsistency
  • Loading branch information
wxiaoguang committed May 6, 2023
1 parent bc888e5 commit db582d9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion services/wiki/wiki_test.go
Expand Up @@ -34,6 +34,9 @@ func TestUserTitleToWebPath(t *testing.T) {
UserTitle string
}
for _, test := range []test{
{"unnamed", ""},
{"unnamed", "."},
{"unnamed", ".."},
{"wiki-name", "wiki name"},
{"title.md.-", "title.md"},
{"wiki-name.-", "wiki-name"},
Expand Down Expand Up @@ -118,7 +121,7 @@ func TestUserWebGitPathConsistency(t *testing.T) {
}

userTitle := strings.TrimSpace(string(b[:l]))
if userTitle == "" || userTitle == "." {
if userTitle == "" || userTitle == "." || userTitle == ".." {
continue
}
webPath := UserTitleToWebPath("", userTitle)
Expand Down

0 comments on commit db582d9

Please sign in to comment.