Skip to content

Commit 211897a

Browse files
committed
ECWID-138834 fixed test testOrderLifecycle after ECWID-115922
1 parent 8d66698 commit 211897a

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

src/test/kotlin/com/ecwid/apiclient/v3/entity/OrdersTest.kt

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,11 @@ private fun UpdatedOrder.cleanupForComparison(order: UpdatedOrder): UpdatedOrder
433433
item.cleanupForComparison(requestItem)
434434
},
435435
customerFiscalCode = null, // ApiOrder has empty string instead of null
436+
discountInfo = order.discountInfo?.map {
437+
it.copy(
438+
appliesToItems = null
439+
)
440+
}
436441
)
437442
}
438443

@@ -445,7 +450,11 @@ private fun UpdatedOrder.OrderItem.cleanupForComparison(orderItem: UpdatedOrder.
445450
selectedOptions = selectedOptions?.mapIndexed { index, option ->
446451
val requestOption = orderItem?.selectedOptions?.get(index)
447452
option.cleanupForComparison(requestOption)
448-
}
453+
},
454+
discounts = discounts?.mapIndexed { index, discount ->
455+
val requestDiscount = orderItem?.discounts?.get(index)
456+
discount.cleanupForComparison(requestDiscount)
457+
},
449458
)
450459
}
451460

@@ -458,3 +467,11 @@ private fun UpdatedOrder.OrderItemSelectedOption.cleanupForComparison(orderItemS
458467
}
459468
)
460469
}
470+
471+
private fun UpdatedOrder.OrderItemDiscounts.cleanupForComparison(orderItemSelectedDiscount: UpdatedOrder.OrderItemDiscounts?): UpdatedOrder.OrderItemDiscounts {
472+
return copy(
473+
discountInfo = orderItemSelectedDiscount?.discountInfo?.copy(
474+
appliesToItems = null
475+
)
476+
)
477+
}

0 commit comments

Comments
 (0)