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"
)

func TestNewRepositories(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() {
			repositories := initialize.NewRepositories(initialize.RepositoriesDeps{
				Logger:  logger,
				MongoDB: t.Client.Database("test"),
			})

			assert.NotNil(t, repositories)
			assert.NotNil(t, repositories.AccountRepository)
			assert.NotNil(t, repositories.HealthRepository)
			assert.NotNil(t, repositories.CurrencyRepository)
			assert.NotNil(t, repositories.HistoryRepository)
		})
	})
}
