Merged in feature/assertions (pull request #158)
Assertions + Gen Text * assert
This commit is contained in:
@@ -10,7 +10,7 @@ import (
|
||||
documenttypes "queryorchestration/internal/document/types"
|
||||
)
|
||||
|
||||
func (s *Service) getDocumentText(ctx context.Context, doc documenttypes.File) (io.Reader, error) {
|
||||
func (s *Service) GetDocumentText(ctx context.Context, doc documenttypes.File) (io.Reader, error) {
|
||||
pagesNum, err := doc.GetPageCount(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -37,7 +37,7 @@ func TestGetDocumentText(t *testing.T) {
|
||||
|
||||
textExpectations(t, ctx, mockTextract, pdf, textractBaseOut)
|
||||
|
||||
text, err := svc.getDocumentText(ctx, pdf)
|
||||
text, err := svc.GetDocumentText(ctx, pdf)
|
||||
require.NoError(t, err)
|
||||
assertReaders(t, txtFile, text)
|
||||
})
|
||||
@@ -63,7 +63,7 @@ func TestGetDocumentText(t *testing.T) {
|
||||
).
|
||||
Return(nil, errors.New("no textract response"))
|
||||
|
||||
_, err := svc.getDocumentText(ctx, pdf)
|
||||
_, err := svc.GetDocumentText(ctx, pdf)
|
||||
require.EqualError(t, err, "no textract response")
|
||||
})
|
||||
t.Run("merged_cell_table", func(t *testing.T) {
|
||||
@@ -80,7 +80,7 @@ func TestGetDocumentText(t *testing.T) {
|
||||
|
||||
textExpectations(t, ctx, mockTextract, pdf, textractBaseOut)
|
||||
|
||||
text, err := svc.getDocumentText(ctx, pdf)
|
||||
text, err := svc.GetDocumentText(ctx, pdf)
|
||||
require.NoError(t, err)
|
||||
|
||||
assertReaders(t, txtFile, text)
|
||||
@@ -99,7 +99,7 @@ func TestGetDocumentText(t *testing.T) {
|
||||
|
||||
textExpectations(t, ctx, mockTextract, pdf, textractBaseOut)
|
||||
|
||||
text, err := svc.getDocumentText(ctx, pdf)
|
||||
text, err := svc.GetDocumentText(ctx, pdf)
|
||||
require.NoError(t, err)
|
||||
|
||||
assertReaders(t, txtFile, text)
|
||||
@@ -118,7 +118,7 @@ func TestGetDocumentText(t *testing.T) {
|
||||
|
||||
textExpectations(t, ctx, mockTextract, pdf, textractBaseOut)
|
||||
|
||||
text, err := svc.getDocumentText(ctx, pdf)
|
||||
text, err := svc.GetDocumentText(ctx, pdf)
|
||||
require.NoError(t, err)
|
||||
|
||||
assertReaders(t, txtFile, text)
|
||||
@@ -137,7 +137,7 @@ func TestGetDocumentText(t *testing.T) {
|
||||
|
||||
textExpectations(t, ctx, mockTextract, pdf, textractBaseOut)
|
||||
|
||||
text, err := svc.getDocumentText(ctx, pdf)
|
||||
text, err := svc.GetDocumentText(ctx, pdf)
|
||||
require.NoError(t, err)
|
||||
|
||||
assertReaders(t, txtFile, text)
|
||||
@@ -156,7 +156,7 @@ func TestGetDocumentText(t *testing.T) {
|
||||
|
||||
textExpectations(t, ctx, mockTextract, pdf, textractBaseOut)
|
||||
|
||||
text, err := svc.getDocumentText(ctx, pdf)
|
||||
text, err := svc.GetDocumentText(ctx, pdf)
|
||||
require.NoError(t, err)
|
||||
|
||||
assertReaders(t, txtFile, text)
|
||||
@@ -175,7 +175,7 @@ func TestGetDocumentText(t *testing.T) {
|
||||
|
||||
textExpectations(t, ctx, mockTextract, pdf, textractBaseOut)
|
||||
|
||||
text, err := svc.getDocumentText(ctx, pdf)
|
||||
text, err := svc.GetDocumentText(ctx, pdf)
|
||||
require.NoError(t, err)
|
||||
|
||||
assertReaders(t, txtFile, text)
|
||||
@@ -195,7 +195,7 @@ func TestGetDocumentText(t *testing.T) {
|
||||
|
||||
textExpectations(t, ctx, mockTextract, pdf, textractBaseOut)
|
||||
|
||||
text, err := svc.getDocumentText(ctx, pdf)
|
||||
text, err := svc.GetDocumentText(ctx, pdf)
|
||||
require.NoError(t, err)
|
||||
|
||||
assertReaders(t, txtFile, text)
|
||||
@@ -214,7 +214,7 @@ func TestGetDocumentText(t *testing.T) {
|
||||
|
||||
textExpectations(t, ctx, mockTextract, pdf, textractBaseOut)
|
||||
|
||||
text, err := svc.getDocumentText(ctx, pdf)
|
||||
text, err := svc.GetDocumentText(ctx, pdf)
|
||||
require.NoError(t, err)
|
||||
|
||||
assertReaders(t, txtFile, text)
|
||||
@@ -233,7 +233,7 @@ func TestGetDocumentText(t *testing.T) {
|
||||
|
||||
textExpectations(t, ctx, mockTextract, pdf, textractBaseOut)
|
||||
|
||||
text, err := svc.getDocumentText(ctx, pdf)
|
||||
text, err := svc.GetDocumentText(ctx, pdf)
|
||||
require.NoError(t, err)
|
||||
|
||||
assertReaders(t, txtFile, text)
|
||||
@@ -252,7 +252,7 @@ func TestGetDocumentText(t *testing.T) {
|
||||
|
||||
textExpectations(t, ctx, mockTextract, pdf, textractBaseOut)
|
||||
|
||||
text, err := svc.getDocumentText(ctx, pdf)
|
||||
text, err := svc.GetDocumentText(ctx, pdf)
|
||||
require.NoError(t, err)
|
||||
|
||||
assertReaders(t, txtFile, text)
|
||||
|
||||
@@ -34,7 +34,7 @@ func (s *Service) executeExtraction(ctx context.Context, documentId uuid.UUID) e
|
||||
return err
|
||||
}
|
||||
|
||||
text, err := s.getDocumentText(ctx, doc)
|
||||
text, err := s.GetDocumentText(ctx, doc)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user