Refactor older tests to use testify (#33140)

Refactor checks to use assert/require
Use require.Eventually for waiting in elastic and meilisearch tests
Use require to exit early instead of assert
This commit is contained in:
TheFox0x7 2025-01-09 02:21:47 +01:00 committed by GitHub
parent fa9191b7b9
commit 2a02734f93
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
42 changed files with 218 additions and 348 deletions

View file

@ -10,6 +10,8 @@ import (
"testing"
"code.gitea.io/gitea/modules/git"
"github.com/stretchr/testify/assert"
)
func BenchmarkGetCommitGraph(b *testing.B) {
@ -235,9 +237,7 @@ func TestParseGlyphs(t *testing.T) {
}
row++
}
if len(parser.availableColors) != 9 {
t.Errorf("Expected 9 colors but have %d", len(parser.availableColors))
}
assert.Len(t, parser.availableColors, 9)
}
func TestCommitStringParsing(t *testing.T) {
@ -262,9 +262,7 @@ func TestCommitStringParsing(t *testing.T) {
return
}
if test.commitMessage != commit.Subject {
t.Errorf("%s does not match %s", test.commitMessage, commit.Subject)
}
assert.Equal(t, test.commitMessage, commit.Subject)
})
}
}