customer/internal/utils/transfer/tariff_test.go
2023-05-30 14:33:57 +03:00

26 lines
779 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package transfer_test
import (
"testing"
"github.com/stretchr/testify/assert"
"penahub.gitlab.yandexcloud.net/pena-services/customer/internal/models"
"penahub.gitlab.yandexcloud.net/pena-services/customer/internal/proto/discount"
"penahub.gitlab.yandexcloud.net/pena-services/customer/internal/utils/transfer"
)
func TestTariffsToProductInformations(t *testing.T) {
t.Run("Успешный перевод массива моделей тарифов в массив информации о продуктах", func(t *testing.T) {
assert.Equal(t,
[]*discount.ProductInformation{
{ID: "1", Price: 20},
{ID: "2", Price: 10},
},
transfer.TariffsToProductInformations([]models.Tariff{
{ID: "1", Price: 20},
{ID: "2", Price: 10},
}),
)
})
}