41 lines
913 B
Go
41 lines
913 B
Go
package contextfull_test
|
|
|
|
import (
|
|
"context"
|
|
contextfull "queryorchestration/internal/contextFull"
|
|
"queryorchestration/internal/database"
|
|
"queryorchestration/internal/database/repository"
|
|
queryprocessor "queryorchestration/internal/queryProcessor"
|
|
"testing"
|
|
|
|
"github.com/google/uuid"
|
|
"github.com/pashagolub/pgxmock/v3"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestCreatorValidate(t *testing.T) {
|
|
ctx := context.Background()
|
|
|
|
pool, err := pgxmock.NewPool()
|
|
if err != nil {
|
|
t.Fatalf("failed to open pgxmock database: %v", err)
|
|
}
|
|
queries := repository.New(pool)
|
|
db := &database.Connection{
|
|
Queries: queries,
|
|
Pool: pool,
|
|
}
|
|
|
|
svc := contextfull.NewCreator(db)
|
|
assert.NotNil(t, svc)
|
|
|
|
entity := &queryprocessor.Create{
|
|
Type: queryprocessor.TypeContextFull,
|
|
RequiredQueryIDs: []uuid.UUID{},
|
|
Config: "",
|
|
}
|
|
|
|
err = svc.Validate(ctx, entity)
|
|
assert.Nil(t, err)
|
|
}
|