修复卖家商品价格展示
This commit is contained in:
@@ -40,3 +40,37 @@ func TestValidateRequestRequiresDepositAboveConsumables(t *testing.T) {
|
||||
t.Fatalf("expected valid request, got %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestApplySellerListingPriceUsesSellerTotalPrice(t *testing.T) {
|
||||
item := &ListingDTO{
|
||||
Price: 238,
|
||||
AssetSummary: map[string]any{
|
||||
"price_breakdown": map[string]any{
|
||||
"seller_total_price": 200,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
applySellerListingPrice(item)
|
||||
|
||||
if item.Price != 200 {
|
||||
t.Fatalf("expected seller price 200, got %.2f", item.Price)
|
||||
}
|
||||
}
|
||||
|
||||
func TestApplySellerListingPriceKeepsFallbackPrice(t *testing.T) {
|
||||
item := &ListingDTO{
|
||||
Price: 238,
|
||||
AssetSummary: map[string]any{
|
||||
"price_breakdown": map[string]any{
|
||||
"seller_total_price": 0,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
applySellerListingPrice(item)
|
||||
|
||||
if item.Price != 238 {
|
||||
t.Fatalf("expected fallback price 238, got %.2f", item.Price)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user