generated from PenaSide/GolangTemplate
debug: rewrite discount products to privileges
This commit is contained in:
parent
d9761c57b1
commit
ab557c7b30
@ -11,7 +11,7 @@ func TariffsToProductInformations(tarrifs []models.Tariff) []*discount.ProductIn
|
||||
|
||||
for _, tariff := range tarrifs {
|
||||
for _, privilege := range tariff.Privileges {
|
||||
productInformations = append(productInformations, PrivilegeToProductInformation(tariff))
|
||||
productInformations = append(productInformations, PrivilegeToProductInformation(privilege))
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,7 +22,7 @@ func PrivilegeToProductInformation(privilege models.Privilege) *discount.Product
|
||||
return &discount.ProductInformation{
|
||||
ID: privilege.ID,
|
||||
Price: privilege.Price,
|
||||
Group: privilege.ServiceKey,
|
||||
Group: &privilege.ServiceKey,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,21 +25,6 @@ func TestTariffsToProductInformations(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func TestTariffToProductInformation(t *testing.T) {
|
||||
t.Run("Успешный перевод модели тарифа в информацию о продукте", func(t *testing.T) {
|
||||
assert.Equal(t,
|
||||
&discount.ProductInformation{
|
||||
ID: "1",
|
||||
Price: 20,
|
||||
},
|
||||
transfer.TariffToProductInformation(models.Tariff{
|
||||
ID: "1",
|
||||
Price: 20,
|
||||
}),
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
func TestTariffMessageProtoToTariffModel(t *testing.T) {
|
||||
t.Run("Успешный перевод прото сообщения тарифа в модель", func(t *testing.T) {
|
||||
assert.Equal(t,
|
||||
|
Loading…
Reference in New Issue
Block a user