package initialize_test import ( "testing" "github.com/stretchr/testify/assert" "go.mongodb.org/mongo-driver/mongo/integration/mtest" "go.uber.org/zap" "penahub.gitlab.yandexcloud.net/pena-services/customer/internal/initialize" "penahub.gitlab.yandexcloud.net/pena-services/customer/internal/models" ) func TestNewServices(t *testing.T) { mt := mtest.New(t, mtest.NewOptions().ClientType(mtest.Mock)) mt.Run("Сервисы должны успешно инициализироваться", func(t *mtest.T) { logger := zap.New(zap.L().Core()) assert.NotPanics(t, func() { clients := initialize.NewClients(initialize.ClientsDeps{ Logger: logger, AuthURL: &models.AuthMicroserviceURL{}, HubadminURL: &models.HubadminMicroserviceURL{}, CurrencyURL: &models.CurrencyMicroserviceURL{}, DiscountServiceConfiguration: &models.DiscountMicroserviceConfiguration{HostGRPC: "host"}, PaymentServiceConfiguration: &models.PaymentMicroserviceConfiguration{HostGRPC: "host"}, }) repositories := initialize.NewRepositories(initialize.RepositoriesDeps{ Logger: logger, MongoDB: t.Client.Database("test"), }) services := initialize.NewServices(initialize.ServicesDeps{ Logger: logger, Clients: clients, Repositories: repositories, ConfigurationGRPC: &models.ConfigurationGRPC{Domen: "http://test:8080"}, }) assert.NotNil(t, services) assert.NotNil(t, services.AccountService) assert.NotNil(t, services.CartService) assert.NotNil(t, services.CurrencyService) assert.NotNil(t, services.HistoryService) assert.NotNil(t, services.WalletService) assert.NotNil(t, services.PaymentService) assert.NotNil(t, services.PaymentCallbackService) }) }) }