Skip to content

Commit 7479e14

Browse files
committed
Fix DtoContractUnitTest
1 parent 420685a commit 7479e14

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

src/main/kotlin/com/ecwid/apiclient/v3/converter/FetchedProduct.kt

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ fun FetchedProduct.ProductOption.RadioOption.toUpdated() = UpdatedProduct.Produc
143143
fun FetchedProduct.ProductOption.SwatchesOption.toUpdated() = UpdatedProduct.ProductOption.SwatchesOption(
144144
name = name,
145145
nameTranslated = nameTranslated,
146-
choices = choices.map { it.toSwatchChoiceUpdated() },
146+
choices = choices.map { it.toUpdated() },
147147
defaultChoice = defaultChoice,
148148
required = required,
149149
useImageAsSwatchSelector = useImageAsSwatchSelector,
@@ -182,18 +182,11 @@ fun FetchedProduct.ProductOption.FilesOption.toUpdated() = UpdatedProduct.Produc
182182
)
183183

184184
fun FetchedProduct.ProductOptionChoice.toUpdated() = UpdatedProduct.ProductOptionChoice(
185-
text = text,
186-
textTranslated = textTranslated,
187-
priceModifier = priceModifier,
188-
priceModifierType = priceModifierType
189-
)
190-
191-
fun FetchedProduct.ProductOptionChoice.toSwatchChoiceUpdated() = UpdatedProduct.ProductOptionChoice(
192185
text = text,
193186
textTranslated = textTranslated,
194187
priceModifier = priceModifier,
195188
priceModifierType = priceModifierType,
196-
hexCodes = hexCodes ?: emptyList(),
189+
hexCodes = hexCodes,
197190
imageId = imageId,
198191
)
199192

src/test/kotlin/com/ecwid/apiclient/v3/rule/NonnullPropertyRules.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ val nonnullPropertyRules: List<NonnullPropertyRule<*, *>> = listOf(
3636
IgnoreNonnull(UpdatedProduct.ProductOption.SelectOption::name),
3737
IgnoreNonnull(UpdatedProduct.ProductOption.SizeOption::choices),
3838
IgnoreNonnull(UpdatedProduct.ProductOption.SizeOption::name),
39+
IgnoreNonnull(UpdatedProduct.ProductOption.SwatchesOption::choices),
40+
IgnoreNonnull(UpdatedProduct.ProductOption.SwatchesOption::name),
41+
IgnoreNonnull(UpdatedProduct.ProductOption.SwatchesOption::useImageAsSwatchSelector),
3942
IgnoreNonnull(UpdatedProduct.ProductOption.TextAreaOption::name),
4043
IgnoreNonnull(UpdatedProduct.ProductOption.TextFieldOption::name),
4144
IgnoreNonnull(UpdatedProduct.ProductOptionChoice::text),

src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/FetchedProductRules.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,12 @@ val fetchedProductNullablePropertyRules: List<NullablePropertyRule<*, *>> = list
130130
IgnoreNullable(FetchedProduct.ProductOption.RadioOption::nameTranslated),
131131
IgnoreNullable(FetchedProduct.ProductOption.SelectOption::nameTranslated),
132132
IgnoreNullable(FetchedProduct.ProductOption.SizeOption::nameTranslated),
133+
AllowNullable(FetchedProduct.ProductOption.SwatchesOption::nameTranslated),
133134
IgnoreNullable(FetchedProduct.ProductOption.TextAreaOption::nameTranslated),
134135
IgnoreNullable(FetchedProduct.ProductOption.TextFieldOption::nameTranslated),
135136
IgnoreNullable(FetchedProduct.ProductOptionChoice::textTranslated),
137+
AllowNullable(FetchedProduct.ProductOptionChoice::hexCodes),
138+
AllowNullable(FetchedProduct.ProductOptionChoice::imageId),
136139
IgnoreNullable(FetchedProduct.RelatedCategory::categoryId),
137140
IgnoreNullable(FetchedProduct.RelatedCategory::enabled),
138141
IgnoreNullable(FetchedProduct.RelatedCategory::productCount),

0 commit comments

Comments
 (0)