Merged in feature/testquery (pull request #39)
Test Query * depstextandclean * startedcleaningresult * resulttidyup * roundone * cleaning * unsyncedquery * startedtestsandsimplification * api * querytests * resultprocessortests * unittests * cleanup
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
package documenttext
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
type Service struct {
|
||||
}
|
||||
|
||||
func New() *Service {
|
||||
return &Service{}
|
||||
}
|
||||
|
||||
func (s *Service) IsValidVersion(v int32) error {
|
||||
if v <= 0 {
|
||||
return errors.New("document clean code version must be > 0")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type IsExtractedParams struct {
|
||||
DocumentID uuid.UUID
|
||||
MinCleanVersion int32
|
||||
MinTextVersion int32
|
||||
}
|
||||
|
||||
func (s *Service) IsExtracted(params *IsExtractedParams) error {
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package documenttext_test
|
||||
|
||||
import (
|
||||
documenttext "queryorchestration/internal/document/text"
|
||||
"testing"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestService(t *testing.T) {
|
||||
svc := documenttext.New()
|
||||
assert.NotNil(t, svc)
|
||||
}
|
||||
|
||||
func TestIsValidVersion(t *testing.T) {
|
||||
svc := documenttext.New()
|
||||
|
||||
assert.Nil(t, svc.IsValidVersion(2))
|
||||
assert.Error(t, svc.IsValidVersion(-1))
|
||||
}
|
||||
|
||||
func TestIsExtracted(t *testing.T) {
|
||||
svc := documenttext.New()
|
||||
|
||||
assert.Nil(t, svc.IsExtracted(&documenttext.IsExtractedParams{
|
||||
DocumentID: uuid.New(),
|
||||
MinCleanVersion: int32(1),
|
||||
MinTextVersion: int32(1),
|
||||
}))
|
||||
}
|
||||
Reference in New Issue
Block a user