package initialize_test

import (
	"testing"

	"gitea.pena/PenaSide/customer/internal/initialize"
	"github.com/stretchr/testify/assert"
	"go.mongodb.org/mongo-driver/mongo/integration/mtest"
	"go.uber.org/zap"
)

func TestNewControllers(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:            "",
				HubadminURL:        "",
				CurrencyURL:        "",
				DiscountServiceURL: "host",
				PaymentServiceURL:  "host",
				VerificationURL:    "",
				TemplategenURL:     "",
			})

			repositories := initialize.NewRepositories(initialize.RepositoriesDeps{
				Logger:  logger,
				MongoDB: t.Client.Database("test"),
			})

			controllers := initialize.NewHttpControllers(initialize.HttpControllersDeps{
				Logger:       logger,
				Repositories: repositories,
				Clients:      clients,
			})

			assert.NotNil(t, controllers)
		})
	})
}
