Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

Commit 874f0ba

Browse files
committed
Fix tests in core package with coupons
1 parent 2f609fe commit 874f0ba

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

core/order_test.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ func TestOpenBazaarNode_CalculateOrderTotal(t *testing.T) {
169169
{
170170
Code: &pb.Listing_Coupon_Hash{Hash: couponHash.B58String()},
171171
Title: "coup",
172-
PercentDiscount: 10,
172+
Discount: &pb.Listing_Coupon_PercentDiscount{PercentDiscount: 10},
173173
},
174174
}
175175

@@ -200,7 +200,7 @@ func TestOpenBazaarNode_CalculateOrderTotal(t *testing.T) {
200200
{
201201
Code: &pb.Listing_Coupon_Hash{Hash: couponHash.B58String()},
202202
Title: "coup",
203-
BigPriceDiscount: "6000",
203+
Discount: &pb.Listing_Coupon_BigPriceDiscount{ BigPriceDiscount: "6000"},
204204
},
205205
}
206206

@@ -454,7 +454,7 @@ func TestOpenBazaarNode_CalculateOrderTotalWithV4Schema(t *testing.T) {
454454
{
455455
Code: &pb.Listing_Coupon_Hash{Hash: couponHash.B58String()},
456456
Title: "coup",
457-
PercentDiscount: 10,
457+
Discount: &pb.Listing_Coupon_PercentDiscount{PercentDiscount: 10},
458458
},
459459
}
460460

@@ -485,7 +485,7 @@ func TestOpenBazaarNode_CalculateOrderTotalWithV4Schema(t *testing.T) {
485485
{
486486
Code: &pb.Listing_Coupon_Hash{Hash: couponHash.B58String()},
487487
Title: "coup",
488-
PriceDiscount: 6000,
488+
Discount: &pb.Listing_Coupon_BigPriceDiscount{BigPriceDiscount: "6000"},
489489
},
490490
}
491491

@@ -503,8 +503,8 @@ func TestOpenBazaarNode_CalculateOrderTotalWithV4Schema(t *testing.T) {
503503
if err != nil {
504504
t.Error(err)
505505
}
506-
if total.Int64() != 69000 {
507-
t.Errorf("Calculated wrong order total. Wanted 69000, got %d", total.Int64())
506+
if total.Int64() != 75000 {
507+
t.Errorf("Calculated wrong order total. Wanted 75000, got %d", total.Int64())
508508
}
509509

510510
// Test with tax no tax shipping
@@ -529,8 +529,8 @@ func TestOpenBazaarNode_CalculateOrderTotalWithV4Schema(t *testing.T) {
529529
if err != nil {
530530
t.Error(err)
531531
}
532-
if total.Int64() != 71200 {
533-
t.Errorf("Calculated wrong order total. Wanted 71200, got %d", total.Int64())
532+
if total.Int64() != 77500 {
533+
t.Errorf("Calculated wrong order total. Wanted 77500, got %d", total.Int64())
534534
}
535535

536536
// Test with tax with tax shipping
@@ -555,8 +555,8 @@ func TestOpenBazaarNode_CalculateOrderTotalWithV4Schema(t *testing.T) {
555555
if err != nil {
556556
t.Error(err)
557557
}
558-
if total.Int64() != 72450 {
559-
t.Fatalf("Calculated wrong order total. Wanted 72450, got %d", total.Int64())
558+
if total.Int64() != 78750 {
559+
t.Fatalf("Calculated wrong order total. Wanted 78750, got %d", total.Int64())
560560
}
561561

562562
// Test local pickup
@@ -575,8 +575,8 @@ func TestOpenBazaarNode_CalculateOrderTotalWithV4Schema(t *testing.T) {
575575
if err != nil {
576576
t.Error(err)
577577
}
578-
if total.Int64() != 46200 {
579-
t.Errorf("Calculated wrong order total. Wanted 46200, got %d", total.Int64())
578+
if total.Int64() != 52500 {
579+
t.Errorf("Calculated wrong order total. Wanted 52500, got %d", total.Int64())
580580
}
581581
}
582582

repo/listing_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ func TestV4PhysicalGoodDataNormalizesToLatestSchema(t *testing.T) {
307307
if c := nlp.Coupons[0]; c == nil {
308308
t.Error("expected coupon to be present, but was nil")
309309
} else {
310-
if cd := c.BigPriceDiscount; cd != fmt.Sprintf("%d", expectedCouponDiscount) {
310+
if cd := c.GetBigPriceDiscount(); cd != fmt.Sprintf("%d", expectedCouponDiscount) {
311311
t.Errorf("expected coupon discount to be (%d), but was (%s)", expectedCouponDiscount, cd)
312312
}
313313
}

0 commit comments

Comments
 (0)