Skip to content

Commit

Permalink
ECWID-147482 testing stuffs
Browse files Browse the repository at this point in the history
  • Loading branch information
carlecwid committed Aug 26, 2024
1 parent 983d696 commit dcffee0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,8 @@ private fun generateTestProduct(
): UpdatedProduct {
return UpdatedProduct(
name = "Product $nameSuffix: ${randomAlphanumeric(8)}",
enabled = enabled
enabled = enabled,
customSlug = "",
)
}

Expand Down Expand Up @@ -601,14 +602,16 @@ private fun generateTestCategory(
seoDescriptionTranslated = LocalizedValueMap(
"ru" to "",
"en" to ""
)
),
customSlug = ""
)
}

private fun UpdatedCategory.cleanupForComparison(): UpdatedCategory {
return copy(
parentId = parentId ?: 0,
// orderBy can be changed by internal ecwid rules so reset it
orderBy = 10
orderBy = 10,
customSlug = "",
)
}
13 changes: 8 additions & 5 deletions src/test/kotlin/com/ecwid/apiclient/v3/entity/ProductsTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ import com.ecwid.apiclient.v3.dto.product.result.GetProductFiltersResult.OptionF
import com.ecwid.apiclient.v3.exception.EcwidApiException
import com.ecwid.apiclient.v3.util.*
import org.junit.jupiter.api.*
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Assertions.assertTrue
import org.junit.jupiter.api.Assertions.*
import java.io.FileInputStream
import java.nio.file.Files
import java.util.*
Expand Down Expand Up @@ -227,7 +226,8 @@ class ProductsTest : BaseEntityTest() {
val productCreateRequest = ProductCreateRequest(
newProduct = UpdatedProduct(
name = "Product ${randomAlphanumeric(8)}",
sku = "testSearchUrls"
sku = "testSearchUrls",
customSlug = ""
)
)
val productCreateResult = apiClient.createProduct(productCreateRequest)
Expand Down Expand Up @@ -1339,7 +1339,8 @@ private fun generateTestCategory(parentId: Int? = null): UpdatedCategory {
name = "Category " + randomAlphanumeric(8),
description = "Description " + randomAlphanumeric(16),
parentId = parentId,
enabled = true
enabled = true,
customSlug = ""
)
}

Expand Down Expand Up @@ -1438,6 +1439,7 @@ private fun generateTestProduct(categoryIds: List<Int> = listOf(), discountsAllo
productCondition = ProductCondition.USED,
externalReferenceId = "EXT_ID_123",
customsHsTariffCode = randomAlphanumeric(10),
customSlug = ""
)
}

Expand Down Expand Up @@ -1647,7 +1649,8 @@ private fun UpdatedProduct.cleanupForComparison(productCreateRequest: ProductCre
subtitleTranslated = LocalizedValueMap(
"ru" to "Сабтайтл",
"en" to "Subtitle"
)
),
customSlug = ""
)
}

Expand Down

0 comments on commit dcffee0

Please sign in to comment.