Merged in feature/checkbox (pull request #145)
Checkbox Primary Edge Cases * hascheckboxlogic * gen * preppinggen * exploringcheckbox * removeunselected * tests * failingtest * failintests * nomockqueryapi * db * name * nocontainer * deleterow * cnc * extradocsandupdatetextracts * moretables * appndedtables * baseversion
This commit is contained in:
@@ -5,7 +5,6 @@ import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"queryorchestration/internal/database/repository"
|
||||
"queryorchestration/internal/serviceconfig"
|
||||
queryc "queryorchestration/internal/serviceconfig/queue/query"
|
||||
queuemock "queryorchestration/mocks/queue"
|
||||
@@ -14,7 +13,6 @@ import (
|
||||
|
||||
"github.com/aws/aws-sdk-go-v2/service/sqs"
|
||||
"github.com/google/uuid"
|
||||
"github.com/pashagolub/pgxmock/v3"
|
||||
"github.com/stretchr/testify/mock"
|
||||
)
|
||||
|
||||
@@ -26,11 +24,7 @@ type ResultSyncConfig struct {
|
||||
func TestTriggerSync(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
cfg := &ResultSyncConfig{}
|
||||
cfg.DBPool = pool
|
||||
cfg.DBQueries = repository.New(pool)
|
||||
mockSQS := queuemock.NewMockSQSClient(t)
|
||||
cfg.QueueClient = mockSQS
|
||||
cfg.QueryURL = "/i/am/here"
|
||||
@@ -54,18 +48,14 @@ func TestTriggerSync(t *testing.T) {
|
||||
).
|
||||
Return(&sqs.SendMessageOutput{}, nil)
|
||||
|
||||
err = svc.TriggerSync(ctx, params)
|
||||
err := svc.TriggerSync(ctx, params)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
func TestTriggerMultiSync(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
cfg := &ResultSyncConfig{}
|
||||
cfg.DBPool = pool
|
||||
cfg.DBQueries = repository.New(pool)
|
||||
mockSQS := queuemock.NewMockSQSClient(t)
|
||||
cfg.QueueClient = mockSQS
|
||||
cfg.QueryURL = "/i/am/here"
|
||||
@@ -98,6 +88,6 @@ func TestTriggerMultiSync(t *testing.T) {
|
||||
).
|
||||
Return(&sqs.SendMessageOutput{}, nil)
|
||||
|
||||
err = svc.TriggerMultiSync(ctx, docId, []*uuid.UUID{&queryIDOne, &queryIDTwo})
|
||||
err := svc.TriggerMultiSync(ctx, docId, []*uuid.UUID{&queryIDOne, &queryIDTwo})
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
package querysync_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"queryorchestration/internal/database/repository"
|
||||
querysync "queryorchestration/internal/query/sync"
|
||||
"queryorchestration/internal/serviceconfig"
|
||||
"queryorchestration/internal/serviceconfig/queue/query"
|
||||
|
||||
"github.com/pashagolub/pgxmock/v3"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
type QuerySyncConfig struct {
|
||||
serviceconfig.BaseConfig
|
||||
query.QueryConfig
|
||||
}
|
||||
|
||||
func TestService(t *testing.T) {
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
cfg := &QuerySyncConfig{}
|
||||
cfg.DBPool = pool
|
||||
cfg.DBQueries = repository.New(pool)
|
||||
svc := querysync.New(cfg, &querysync.Services{})
|
||||
assert.NotNil(t, svc)
|
||||
}
|
||||
@@ -1,33 +1,21 @@
|
||||
package contextfull_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"queryorchestration/internal/database/repository"
|
||||
resultprocessor "queryorchestration/internal/query/result/processor"
|
||||
contextfull "queryorchestration/internal/query/types/contextFull"
|
||||
"queryorchestration/internal/serviceconfig"
|
||||
|
||||
"github.com/pashagolub/pgxmock/v3"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestCreatorValidate(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
cfg.DBPool = pool
|
||||
cfg.DBQueries = repository.New(pool)
|
||||
|
||||
svc := contextfull.NewCreator()
|
||||
|
||||
entity := &resultprocessor.Create{
|
||||
Type: resultprocessor.TypeContextFull,
|
||||
}
|
||||
|
||||
err = svc.Validate(ctx, entity)
|
||||
err := svc.Validate(t.Context(), entity)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
@@ -1,29 +1,16 @@
|
||||
package contextfull_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"queryorchestration/internal/database/repository"
|
||||
resultprocessor "queryorchestration/internal/query/result/processor"
|
||||
contextfull "queryorchestration/internal/query/types/contextFull"
|
||||
"queryorchestration/internal/serviceconfig"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/pashagolub/pgxmock/v3"
|
||||
)
|
||||
|
||||
func TestUpdatorValidate(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
cfg.DBPool = pool
|
||||
cfg.DBQueries = repository.New(pool)
|
||||
|
||||
svc := contextfull.NewUpdator()
|
||||
|
||||
current := &resultprocessor.Query{
|
||||
@@ -36,6 +23,6 @@ func TestUpdatorValidate(t *testing.T) {
|
||||
ID: current.ID,
|
||||
}
|
||||
|
||||
err = svc.Validate(ctx, current, entity)
|
||||
err := svc.Validate(t.Context(), current, entity)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
@@ -1,28 +1,15 @@
|
||||
package jsonextractor_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"queryorchestration/internal/database/repository"
|
||||
resultprocessor "queryorchestration/internal/query/result/processor"
|
||||
jsonextractor "queryorchestration/internal/query/types/jsonExtractor"
|
||||
"queryorchestration/internal/serviceconfig"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/pashagolub/pgxmock/v3"
|
||||
)
|
||||
|
||||
func TestCreatorValidate(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
cfg.DBPool = pool
|
||||
cfg.DBQueries = repository.New(pool)
|
||||
|
||||
svc := jsonextractor.NewCreator()
|
||||
|
||||
ccfg := "{}"
|
||||
@@ -31,6 +18,6 @@ func TestCreatorValidate(t *testing.T) {
|
||||
Config: &ccfg,
|
||||
}
|
||||
|
||||
err = svc.Validate(ctx, entity)
|
||||
err := svc.Validate(t.Context(), entity)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
@@ -168,11 +168,7 @@ func TestJSONProcessJSON(t *testing.T) {
|
||||
func TestJSONProcessResults(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
cfg.DBPool = pool
|
||||
cfg.DBQueries = repository.New(pool)
|
||||
|
||||
extractor := jsonextractor.NewExtractor(cfg)
|
||||
|
||||
|
||||
@@ -1,28 +1,16 @@
|
||||
package jsonextractor_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"queryorchestration/internal/database/repository"
|
||||
resultprocessor "queryorchestration/internal/query/result/processor"
|
||||
jsonextractor "queryorchestration/internal/query/types/jsonExtractor"
|
||||
"queryorchestration/internal/serviceconfig"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/pashagolub/pgxmock/v3"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestUpdatorValidate(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
cfg.DBPool = pool
|
||||
cfg.DBQueries = repository.New(pool)
|
||||
|
||||
svc := jsonextractor.NewUpdator()
|
||||
|
||||
current := &resultprocessor.Query{
|
||||
@@ -35,6 +23,6 @@ func TestUpdatorValidate(t *testing.T) {
|
||||
ID: current.ID,
|
||||
}
|
||||
|
||||
err = svc.Validate(ctx, current, entity)
|
||||
err := svc.Validate(t.Context(), current, entity)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
@@ -29,11 +29,7 @@ type QueryUpdateConfig struct {
|
||||
}
|
||||
|
||||
func TestGetUpdator(t *testing.T) {
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
cfg := &QueryUpdateConfig{}
|
||||
cfg.DBPool = pool
|
||||
cfg.DBQueries = repository.New(pool)
|
||||
svc := New(cfg, &Services{
|
||||
Query: query.New(cfg),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user