Files
query-orchestration/internal/test/assertions.go
T
Michael McGuinness fee71e7740 Merged in feature/postprocessing (pull request #114)
Feature/postprocessing

* tests

* passtest

* fixshorttests

* mosttests

* improvingbasedockerfile

* testspeeds

* testing

* host

* canparallel

* clean

* passfullsuite

* singlepagemax

* test

* findfeatures

* findstables

* tbls

* tablestoo

* tablestoo

* lateraltests

* tableloc

* cleanup

* inlinetable

* childids

* cleanup

* tests
2025-04-22 14:40:16 +00:00

37 lines
893 B
Go

package test
import (
"encoding/json"
"io"
"os"
"testing"
"github.com/aws/aws-sdk-go-v2/service/textract"
"github.com/google/go-cmp/cmp"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func GetTextractFileResponse(t testing.TB, filename string) map[string][]textract.DetectDocumentTextOutput {
file, err := os.Open(filename)
require.NoError(t, err)
defer file.Close()
decoder := json.NewDecoder(file)
var out map[string][]textract.DetectDocumentTextOutput
err = decoder.Decode(&out)
require.NoError(t, err)
return out
}
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)
}
}