Skip to content

Commit

Permalink
ECWID-138834 fixed test testOrderLifecycle after ECWID-115922
Browse files Browse the repository at this point in the history
  • Loading branch information
winrokru committed Jun 11, 2024
1 parent 8d66698 commit 211897a
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/test/kotlin/com/ecwid/apiclient/v3/entity/OrdersTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,11 @@ private fun UpdatedOrder.cleanupForComparison(order: UpdatedOrder): UpdatedOrder
item.cleanupForComparison(requestItem)
},
customerFiscalCode = null, // ApiOrder has empty string instead of null
discountInfo = order.discountInfo?.map {
it.copy(
appliesToItems = null
)
}
)
}

Expand All @@ -445,7 +450,11 @@ private fun UpdatedOrder.OrderItem.cleanupForComparison(orderItem: UpdatedOrder.
selectedOptions = selectedOptions?.mapIndexed { index, option ->
val requestOption = orderItem?.selectedOptions?.get(index)
option.cleanupForComparison(requestOption)
}
},
discounts = discounts?.mapIndexed { index, discount ->
val requestDiscount = orderItem?.discounts?.get(index)
discount.cleanupForComparison(requestDiscount)
},
)
}

Expand All @@ -458,3 +467,11 @@ private fun UpdatedOrder.OrderItemSelectedOption.cleanupForComparison(orderItemS
}
)
}

private fun UpdatedOrder.OrderItemDiscounts.cleanupForComparison(orderItemSelectedDiscount: UpdatedOrder.OrderItemDiscounts?): UpdatedOrder.OrderItemDiscounts {
return copy(
discountInfo = orderItemSelectedDiscount?.discountInfo?.copy(
appliesToItems = null
)
)
}

0 comments on commit 211897a

Please sign in to comment.