修复卖家商品价格展示

This commit is contained in:
yml
2026-05-25 15:12:40 +08:00
parent 7e7e6dc166
commit e270ce8bfc
5 changed files with 78 additions and 23 deletions
@@ -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)
}
}