Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .DS_Store
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ fun FetchedProduct.toUpdated(): UpdatedProduct {
minPurchaseQuantity = minPurchaseQuantity,
maxPurchaseQuantity = maxPurchaseQuantity,
reviewsCollectingAllowed = reviewsCollectingAllowed,
batteryIncluded = batteryIncluded,
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ data class UpdatedProduct(
val minPurchaseQuantity: Int? = null,
val maxPurchaseQuantity: Int? = null,
val reviewsCollectingAllowed: Boolean? = null,
val batteryIncluded: Boolean? = null,
) : ApiUpdatedDTO {

data class Ribbon(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ data class FetchedProduct(
val minPurchaseQuantity: Int? = null,
val maxPurchaseQuantity: Int? = null,
val reviewsCollectingAllowed: Boolean? = null,
val batteryIncluded: Boolean? = null,
val rating: Double? = null,
val reviewsModerated: Int? = null,
val reviewsPublished: Int? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import com.ecwid.apiclient.v3.exception.EcwidApiException
import com.ecwid.apiclient.v3.util.randomAlphanumeric
import com.ecwid.apiclient.v3.util.randomBoolean
import com.ecwid.apiclient.v3.util.randomEmail
import com.ecwid.apiclient.v3.util.randomNumeric
import org.junit.jupiter.api.Assertions.*
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Disabled
Expand Down Expand Up @@ -419,7 +420,7 @@ private fun generateTestCustomerForCreate(customerGroupId: Int?): UpdatedCustome
generateShippingAddress(),
generateShippingAddress()
),
taxId = randomAlphanumeric(8),
taxId = randomNumeric(8),
taxIdValid = randomBoolean(),
taxExempt = randomBoolean(),
acceptMarketing = randomBoolean(),
Expand All @@ -444,7 +445,7 @@ private fun generateTestCustomerForUpdate(
generateShippingAddress(oldShippingAddresses?.get(2)?.id),
generateShippingAddress(oldShippingAddresses?.get(3)?.id)
),
taxId = randomAlphanumeric(8),
taxId = randomNumeric(8),
taxIdValid = randomBoolean(),
taxExempt = randomBoolean(),
acceptMarketing = randomBoolean(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ val fetchedProductNullablePropertyRules: List<NullablePropertyRule<*, *>> = list
AllowNullable(FetchedProduct::rating),
IgnoreNullable(FetchedProduct::relatedProducts),
AllowNullable(FetchedProduct::reviewsCollectingAllowed),
AllowNullable(FetchedProduct::batteryIncluded),
AllowNullable(FetchedProduct::reviewsModerated),
AllowNullable(FetchedProduct::reviewsPublished),
IgnoreNullable(FetchedProduct::ribbon),
Expand Down
8 changes: 8 additions & 0 deletions src/test/kotlin/com/ecwid/apiclient/v3/util/RandomUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ internal fun randomAlphanumeric(size: Int): String {
.joinToString("")
}

internal fun randomNumeric(size: Int): String {
val digits = ('0'..'9').toList()
return (1..size)
.map { Random.nextInt(0, digits.size) }
.map(digits::get)
.joinToString("")
}

internal inline fun <reified E : Enum<E>> randomEnumValue(vararg exclude: E): E {
return E::class.java.enumConstants
.toSortedSet()
Expand Down
Loading