1
1
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:
TheFox0x7
2025-01-09 02:21:47 +01:00
committed by GitHub
parent fa9191b7b9
commit 2a02734f93
42 changed files with 218 additions and 348 deletions

View File

@@ -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)
}