@@ -5,15 +5,11 @@ import (
|
||||
"testing"
|
||||
|
||||
"queryorchestration/internal/client"
|
||||
"queryorchestration/internal/collector"
|
||||
"queryorchestration/internal/database"
|
||||
"queryorchestration/internal/database/repository"
|
||||
cleanversion "queryorchestration/internal/document/clean/version"
|
||||
textversion "queryorchestration/internal/document/text/version"
|
||||
"queryorchestration/internal/serviceconfig"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/jackc/pgx/v5"
|
||||
"github.com/pashagolub/pgxmock/v3"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
@@ -28,12 +24,7 @@ func TestCreate(t *testing.T) {
|
||||
cfg.DBPool = pool
|
||||
cfg.DBQueries = repository.New(pool)
|
||||
|
||||
svc := client.New(cfg, &client.Services{
|
||||
Collector: collector.New(cfg, &collector.Services{
|
||||
CleanVersion: cleanversion.New(cfg),
|
||||
TextVersion: textversion.New(cfg),
|
||||
}),
|
||||
})
|
||||
svc := client.New(cfg)
|
||||
|
||||
name := "client_name"
|
||||
aid := uuid.New()
|
||||
@@ -43,14 +34,6 @@ func TestCreate(t *testing.T) {
|
||||
pgxmock.NewRows([]string{"id"}).
|
||||
AddRow(database.MustToDBUUID(aid)),
|
||||
)
|
||||
pool.ExpectBeginTx(pgx.TxOptions{})
|
||||
pool.ExpectQuery("name: AddLatestCollectorVersion :one").WithArgs(database.MustToDBUUID(aid)).WillReturnRows(
|
||||
pgxmock.NewRows([]string{"version"}).
|
||||
AddRow(int32(1)),
|
||||
)
|
||||
pool.ExpectExec("name: SetActiveCollectorVersion :exec").WithArgs(database.MustToDBUUID(aid), int32(1)).
|
||||
WillReturnResult(pgxmock.NewResult("", 1))
|
||||
pool.ExpectCommit()
|
||||
|
||||
id, err := svc.Create(ctx, name)
|
||||
assert.NoError(t, err)
|
||||
|
||||
Reference in New Issue
Block a user