2023-05-16 01:12:07 +00:00
|
|
|
package initialize_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"go.mongodb.org/mongo-driver/mongo/integration/mtest"
|
2023-05-19 04:50:40 +00:00
|
|
|
"go.uber.org/zap"
|
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 TestNewRepositories(t *testing.T) {
|
|
|
|
mt := mtest.New(t, mtest.NewOptions().ClientType(mtest.Mock))
|
|
|
|
|
|
|
|
mt.Run("Репозитории должны успешно инициализироваться", func(t *mtest.T) {
|
2023-05-19 04:50:40 +00:00
|
|
|
logger := zap.New(zap.L().Core())
|
|
|
|
|
2023-05-16 01:12:07 +00:00
|
|
|
assert.NotPanics(t, func() {
|
|
|
|
repositories := initialize.NewRepositories(&initialize.RepositoriesDeps{
|
2023-05-19 04:50:40 +00:00
|
|
|
Logger: logger,
|
2023-05-16 01:12:07 +00:00
|
|
|
MongoDB: t.Client.Database("test"),
|
|
|
|
})
|
|
|
|
|
|
|
|
assert.NotNil(t, repositories)
|
2023-05-17 20:27:09 +00:00
|
|
|
assert.NotNil(t, repositories.AccountRepository)
|
2023-05-16 01:12:07 +00:00
|
|
|
assert.NotNil(t, repositories.HealthRepository)
|
2023-05-19 04:50:40 +00:00
|
|
|
assert.NotNil(t, repositories.CurrencyRepository)
|
2023-05-16 01:12:07 +00:00
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|