mirror of
				https://github.com/go-gitea/gitea
				synced 2025-11-03 21:08:25 +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:
		@@ -6,6 +6,9 @@ package eventsource
 | 
			
		||||
import (
 | 
			
		||||
	"bytes"
 | 
			
		||||
	"testing"
 | 
			
		||||
 | 
			
		||||
	"github.com/stretchr/testify/assert"
 | 
			
		||||
	"github.com/stretchr/testify/require"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func Test_wrapNewlines(t *testing.T) {
 | 
			
		||||
@@ -38,16 +41,10 @@ func Test_wrapNewlines(t *testing.T) {
 | 
			
		||||
		t.Run(tt.name, func(t *testing.T) {
 | 
			
		||||
			w := &bytes.Buffer{}
 | 
			
		||||
			gotSum, err := wrapNewlines(w, []byte(tt.prefix), []byte(tt.value))
 | 
			
		||||
			if err != nil {
 | 
			
		||||
				t.Errorf("wrapNewlines() error = %v", err)
 | 
			
		||||
				return
 | 
			
		||||
			}
 | 
			
		||||
			if gotSum != int64(len(tt.output)) {
 | 
			
		||||
				t.Errorf("wrapNewlines() = %v, want %v", gotSum, int64(len(tt.output)))
 | 
			
		||||
			}
 | 
			
		||||
			if gotW := w.String(); gotW != tt.output {
 | 
			
		||||
				t.Errorf("wrapNewlines() = %v, want %v", gotW, tt.output)
 | 
			
		||||
			}
 | 
			
		||||
			require.NoError(t, err)
 | 
			
		||||
 | 
			
		||||
			assert.EqualValues(t, len(tt.output), gotSum)
 | 
			
		||||
			assert.Equal(t, tt.output, w.String())
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user