feat(t239): persist freight item metadata
This commit is contained in:
@@ -33,6 +33,19 @@ func TestFreightNormalizationHashExcludesInternalIDs(t *testing.T) {
|
||||
second.Orders[0].CanonicalSHA256,
|
||||
)
|
||||
}
|
||||
changed := validFreightSource()
|
||||
changedPrice := *changed.Orders[0].Items[0].OriginalUnitPriceMinor + 1
|
||||
changed.Orders[0].Items[0].OriginalUnitPriceMinor = &changedPrice
|
||||
changedBatch, err := firstService.normalize(changed)
|
||||
if err != nil {
|
||||
t.Fatalf("changed price normalize error = %v", err)
|
||||
}
|
||||
if first.Orders[0].CanonicalSHA256 ==
|
||||
changedBatch.Orders[0].CanonicalSHA256 ||
|
||||
first.Orders[0].Items[0].CanonicalSHA256 ==
|
||||
changedBatch.Orders[0].Items[0].CanonicalSHA256 {
|
||||
t.Fatal("canonical hash ignored original unit price")
|
||||
}
|
||||
}
|
||||
|
||||
func TestFreightNormalizationRejectsConflictingIdentityAndInvalidTime(
|
||||
@@ -466,6 +479,7 @@ func validFreightSource() domain.FreightSourceBatch {
|
||||
thumb := "190"
|
||||
itemPurchaseStatus := "0"
|
||||
quantity := 2
|
||||
originalUnitPriceMinor := int64(12950)
|
||||
canceled := false
|
||||
return domain.FreightSourceBatch{
|
||||
SchemaVersion: 1,
|
||||
@@ -481,13 +495,15 @@ func validFreightSource() domain.FreightSourceBatch {
|
||||
PurchaseStatus: &purchaseStatus,
|
||||
IsCanceled: &canceled,
|
||||
Items: []domain.FreightSourceItem{{
|
||||
ExternalItemID: "88",
|
||||
Title: "商品",
|
||||
ProductSpec: "黑色,L",
|
||||
SKU: "BLACK-L",
|
||||
Quantity: &quantity,
|
||||
ProductThumbRef: &thumb,
|
||||
PurchaseStatus: &itemPurchaseStatus,
|
||||
ExternalItemID: "88",
|
||||
Title: "商品",
|
||||
ProductSpec: "黑色,L",
|
||||
SKU: "黑色,L",
|
||||
Quantity: &quantity,
|
||||
ProductThumbRef: &thumb,
|
||||
OriginalUnitPriceMinor: &originalUnitPriceMinor,
|
||||
OriginalCurrency: domain.FreightCurrencyTWD,
|
||||
PurchaseStatus: &itemPurchaseStatus,
|
||||
}},
|
||||
}},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user