mirror of
https://github.com/go-gitea/gitea
synced 2025-07-16 07:18:37 +00:00
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:
@@ -20,6 +20,7 @@ import (
|
||||
wiki_service "code.gitea.io/gitea/services/wiki"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -66,12 +67,9 @@ func assertWikiNotExists(t *testing.T, repo *repo_model.Repository, wikiName wik
|
||||
|
||||
func assertPagesMetas(t *testing.T, expectedNames []string, metas any) {
|
||||
pageMetas, ok := metas.([]PageMeta)
|
||||
if !assert.True(t, ok) {
|
||||
return
|
||||
}
|
||||
if !assert.Len(t, pageMetas, len(expectedNames)) {
|
||||
return
|
||||
}
|
||||
require.True(t, ok)
|
||||
require.Len(t, pageMetas, len(expectedNames))
|
||||
|
||||
for i, pageMeta := range pageMetas {
|
||||
assert.EqualValues(t, expectedNames[i], pageMeta.Name)
|
||||
}
|
||||
|
Reference in New Issue
Block a user