1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Enable testifylint rules (#34075)

enable testifylint rules disabled in:
https://github.com/go-gitea/gitea/pull/34054
This commit is contained in:
TheFox0x7
2025-03-31 07:53:48 +02:00
committed by GitHub
parent 0fd5392087
commit 0fde8ecd55
262 changed files with 1315 additions and 1365 deletions

View File

@@ -26,7 +26,7 @@ func TestMain(m *testing.M) {
func TestWebPathSegments(t *testing.T) {
a := WebPathSegments("a%2Fa/b+c/d-e/f-g.-")
assert.EqualValues(t, []string{"a/a", "b c", "d e", "f-g"}, a)
assert.Equal(t, []string{"a/a", "b c", "d e", "f-g"}, a)
}
func TestUserTitleToWebPath(t *testing.T) {
@@ -63,7 +63,7 @@ func TestWebPathToDisplayName(t *testing.T) {
{"a b", "a%20b.md"},
} {
_, displayName := WebPathToUserTitle(test.WebPath)
assert.EqualValues(t, test.Expected, displayName)
assert.Equal(t, test.Expected, displayName)
}
}
@@ -80,7 +80,7 @@ func TestWebPathToGitPath(t *testing.T) {
{"2000-01-02-meeting.md", "2000-01-02+meeting"},
{"2000-01-02 meeting.-.md", "2000-01-02%20meeting.-"},
} {
assert.EqualValues(t, test.Expected, WebPathToGitPath(test.WikiName))
assert.Equal(t, test.Expected, WebPathToGitPath(test.WikiName))
}
}
@@ -134,9 +134,9 @@ func TestUserWebGitPathConsistency(t *testing.T) {
_, userTitle1 := WebPathToUserTitle(webPath1)
gitPath1 := WebPathToGitPath(webPath1)
assert.EqualValues(t, userTitle, userTitle1, "UserTitle for userTitle: %q", userTitle)
assert.EqualValues(t, webPath, webPath1, "WebPath for userTitle: %q", userTitle)
assert.EqualValues(t, gitPath, gitPath1, "GitPath for userTitle: %q", userTitle)
assert.Equal(t, userTitle, userTitle1, "UserTitle for userTitle: %q", userTitle)
assert.Equal(t, webPath, webPath1, "WebPath for userTitle: %q", userTitle)
assert.Equal(t, gitPath, gitPath1, "GitPath for userTitle: %q", userTitle)
}
}
@@ -175,7 +175,7 @@ func TestRepository_AddWikiPage(t *testing.T) {
gitPath := WebPathToGitPath(webPath)
entry, err := masterTree.GetTreeEntryByPath(gitPath)
assert.NoError(t, err)
assert.EqualValues(t, gitPath, entry.Name(), "%s not added correctly", userTitle)
assert.Equal(t, gitPath, entry.Name(), "%s not added correctly", userTitle)
})
}
@@ -220,7 +220,7 @@ func TestRepository_EditWikiPage(t *testing.T) {
gitPath := WebPathToGitPath(webPath)
entry, err := masterTree.GetTreeEntryByPath(gitPath)
assert.NoError(t, err)
assert.EqualValues(t, gitPath, entry.Name(), "%s not edited correctly", newWikiName)
assert.Equal(t, gitPath, entry.Name(), "%s not edited correctly", newWikiName)
if newWikiName != "Home" {
_, err := masterTree.GetTreeEntryByPath("Home.md")
@@ -290,7 +290,7 @@ func TestPrepareWikiFileName(t *testing.T) {
t.Errorf("expect to find an escaped file but we could not detect one")
}
}
assert.EqualValues(t, tt.wikiPath, newWikiPath)
assert.Equal(t, tt.wikiPath, newWikiPath)
})
}
}
@@ -312,13 +312,13 @@ func TestPrepareWikiFileName_FirstPage(t *testing.T) {
existence, newWikiPath, err := prepareGitPath(gitRepo, "master", "Home")
assert.False(t, existence)
assert.NoError(t, err)
assert.EqualValues(t, "Home.md", newWikiPath)
assert.Equal(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("")))
assert.Empty(t, WebPathToURLPath(WebPath("")))
}
func TestWebPathFromRequest(t *testing.T) {