35d72fccbe
Feature/remove mocks * remove mocks * cleanup db migrations
25 lines
744 B
Go
25 lines
744 B
Go
// Package test provides test utilities.
|
|
// Note: Textract-related helpers have been removed since text extraction is deprecated.
|
|
// See remove_texttract_and_mocks_plan.md for details.
|
|
package test
|
|
|
|
import (
|
|
"io"
|
|
"testing"
|
|
|
|
"github.com/google/go-cmp/cmp"
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
// AssertStringToReader compares an expected string with the content from a reader.
|
|
func AssertStringToReader(t testing.TB, expected string, actual io.Reader) {
|
|
actualBytes, err := io.ReadAll(actual)
|
|
require.NoError(t, err)
|
|
actualStr := string(actualBytes)
|
|
if !assert.Equal(t, expected, actualStr) {
|
|
diff := cmp.Diff(expected, actualStr)
|
|
t.Logf("Detailed diff (-expected +actual):\n%s", diff)
|
|
}
|
|
}
|