Merged in feature/textextract (pull request #108)
Start adding Textract + UUID changes * base * startclient * ts * short * tests
This commit is contained in:
@@ -3,13 +3,11 @@ package query_test
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"queryorchestration/internal/database"
|
||||
"queryorchestration/internal/database/repository"
|
||||
"queryorchestration/internal/query"
|
||||
resultprocessor "queryorchestration/internal/query/result/processor"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/jackc/pgx/v5/pgtype"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
@@ -39,12 +37,12 @@ func TestParseQuery(t *testing.T) {
|
||||
|
||||
func TestParseFullActiveQuery(t *testing.T) {
|
||||
q := &repository.Fullactivequery{
|
||||
ID: database.MustToDBUUID(uuid.New()),
|
||||
ID: uuid.New(),
|
||||
Type: repository.QuerytypeContextFull,
|
||||
Activeversion: int32(1),
|
||||
Latestversion: int32(2),
|
||||
Requiredids: []pgtype.UUID{
|
||||
database.MustToDBUUID(uuid.New()),
|
||||
Requiredids: []uuid.UUID{
|
||||
uuid.New(),
|
||||
},
|
||||
Config: []byte("example"),
|
||||
}
|
||||
@@ -53,12 +51,12 @@ func TestParseFullActiveQuery(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
bcfg := string(q.Config)
|
||||
assert.EqualExportedValues(t, query.Query{
|
||||
ID: database.MustToUUID(q.ID),
|
||||
ID: q.ID,
|
||||
Type: resultprocessor.TypeContextFull,
|
||||
ActiveVersion: q.Activeversion,
|
||||
LatestVersion: q.Latestversion,
|
||||
RequiredQueryIDs: &[]uuid.UUID{
|
||||
database.MustToUUID(q.Requiredids[0]),
|
||||
q.Requiredids[0],
|
||||
},
|
||||
Config: &bcfg,
|
||||
}, *out)
|
||||
@@ -66,7 +64,7 @@ func TestParseFullActiveQuery(t *testing.T) {
|
||||
|
||||
func TestFullActiveQueryEmpty(t *testing.T) {
|
||||
dbQuery := &repository.Fullactivequery{
|
||||
ID: database.MustToDBUUID(uuid.New()),
|
||||
ID: uuid.New(),
|
||||
Type: repository.QuerytypeContextFull,
|
||||
Activeversion: int32(1),
|
||||
Latestversion: int32(2),
|
||||
@@ -75,7 +73,7 @@ func TestFullActiveQueryEmpty(t *testing.T) {
|
||||
out, err := query.ParseFullActiveQuery(dbQuery)
|
||||
require.NoError(t, err)
|
||||
assert.EqualExportedValues(t, query.Query{
|
||||
ID: database.MustToUUID(dbQuery.ID),
|
||||
ID: dbQuery.ID,
|
||||
Type: resultprocessor.TypeContextFull,
|
||||
ActiveVersion: int32(1),
|
||||
LatestVersion: int32(2),
|
||||
@@ -84,7 +82,7 @@ func TestFullActiveQueryEmpty(t *testing.T) {
|
||||
|
||||
func TestFullActiveQueryWithNullUUID(t *testing.T) {
|
||||
dbQuery := &repository.Fullactivequery{
|
||||
ID: database.MustToDBUUID(uuid.New()),
|
||||
ID: uuid.New(),
|
||||
Type: repository.QuerytypeContextFull,
|
||||
Activeversion: int32(1),
|
||||
Latestversion: int32(2),
|
||||
@@ -93,7 +91,7 @@ func TestFullActiveQueryWithNullUUID(t *testing.T) {
|
||||
out, err := query.ParseFullActiveQuery(dbQuery)
|
||||
require.NoError(t, err)
|
||||
assert.EqualExportedValues(t, query.Query{
|
||||
ID: database.MustToUUID(dbQuery.ID),
|
||||
ID: dbQuery.ID,
|
||||
Type: resultprocessor.TypeContextFull,
|
||||
ActiveVersion: int32(1),
|
||||
LatestVersion: int32(2),
|
||||
@@ -103,7 +101,7 @@ func TestFullActiveQueryWithNullUUID(t *testing.T) {
|
||||
func TestFullActiveQueryArray(t *testing.T) {
|
||||
dbQueries := []*repository.Fullactivequery{
|
||||
{
|
||||
ID: database.MustToDBUUID(uuid.New()),
|
||||
ID: uuid.New(),
|
||||
Type: repository.QuerytypeContextFull,
|
||||
Activeversion: int32(1),
|
||||
Latestversion: int32(2),
|
||||
@@ -114,7 +112,7 @@ func TestFullActiveQueryArray(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
assert.EqualExportedValues(t, []*query.Query{
|
||||
{
|
||||
ID: database.MustToUUID(dbQueries[0].ID),
|
||||
ID: dbQueries[0].ID,
|
||||
Type: resultprocessor.TypeContextFull,
|
||||
ActiveVersion: int32(1),
|
||||
LatestVersion: int32(2),
|
||||
|
||||
Reference in New Issue
Block a user