2023-05-16 01:12:07 +00:00
|
|
|
package initialize_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
2023-05-18 12:26:37 +00:00
|
|
|
"go.mongodb.org/mongo-driver/mongo/integration/mtest"
|
2023-05-16 04:01:55 +00:00
|
|
|
"penahub.gitlab.yandexcloud.net/pena-services/customer/internal/initialize"
|
2023-05-16 01:12:07 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestNewServices(t *testing.T) {
|
2023-05-18 12:26:37 +00:00
|
|
|
mt := mtest.New(t, mtest.NewOptions().ClientType(mtest.Mock))
|
2023-05-16 01:12:07 +00:00
|
|
|
|
2023-05-18 12:26:37 +00:00
|
|
|
mt.Run("Сервисы должны успешно инициализироваться", func(t *mtest.T) {
|
2023-05-16 01:12:07 +00:00
|
|
|
assert.NotPanics(t, func() {
|
2023-05-18 12:26:37 +00:00
|
|
|
clients := initialize.NewClients(&initialize.ClientsDeps{})
|
|
|
|
repositories := initialize.NewRepositories(&initialize.RepositoriesDeps{
|
|
|
|
MongoDB: t.Client.Database("test"),
|
|
|
|
})
|
2023-05-16 01:12:07 +00:00
|
|
|
services := initialize.NewServices(&initialize.ServicesDeps{
|
2023-05-18 12:26:37 +00:00
|
|
|
Clients: clients,
|
|
|
|
Repositories: repositories,
|
2023-05-16 01:12:07 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
assert.NotNil(t, services)
|
2023-05-18 12:26:37 +00:00
|
|
|
assert.NotNil(t, services.AccountService)
|
|
|
|
assert.NotNil(t, services.AccountService.AuthClient)
|
|
|
|
assert.NotNil(t, services.AccountService.Repository)
|
2023-05-16 01:12:07 +00:00
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|