Skip to content

Commit fcd19ef

Browse files
author
Sharma Elanthiriayan
committed
- Update makeOrderTaxLine method to take in totalShippingTax as a parameter.
1 parent 8f3cd52 commit fcd19ef

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

WooCommerce/WooCommerceTests/Tools/MockOrders.swift

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,11 @@ final class MockOrders {
4343
shippingLines: [ShippingLine] = sampleShippingLines(),
4444
refunds: [OrderRefundCondensed] = [],
4545
fees: [OrderFeeLine] = []) -> Order {
46+
let shippingTax = "0.00"
4647
let totalTax = "1.20"
48+
let tax = makeOrderTaxLine(totalShippingTax: shippingTax,
49+
totalTax: totalTax)
50+
4751
return Order(siteID: siteID,
4852
orderID: orderID,
4953
parentID: 0,
@@ -59,7 +63,7 @@ final class MockOrders {
5963
discountTotal: "30.00",
6064
discountTax: "1.20",
6165
shippingTotal: "0.00",
62-
shippingTax: "0.00",
66+
shippingTax: shippingTax,
6367
total: "31.20",
6468
totalTax: totalTax,
6569
paymentMethodID: "stripe",
@@ -71,7 +75,7 @@ final class MockOrders {
7175
coupons: [],
7276
refunds: refunds,
7377
fees: fees,
74-
taxes: [makeOrderTaxLine(totalTax: totalTax)]
78+
taxes: [tax]
7579
)
7680
}
7781

@@ -92,7 +96,11 @@ final class MockOrders {
9296
}
9397

9498
func sampleOrderCreatedInCurrentYear() -> Order {
99+
let shippingTax = "0.00"
95100
let totalTax = "1.20"
101+
let tax = makeOrderTaxLine(totalShippingTax: shippingTax,
102+
totalTax: totalTax)
103+
96104
return Order(siteID: siteID,
97105
orderID: orderID,
98106
parentID: 0,
@@ -108,7 +116,7 @@ final class MockOrders {
108116
discountTotal: "30.00",
109117
discountTax: "1.20",
110118
shippingTotal: "0.00",
111-
shippingTax: "0.00",
119+
shippingTax: shippingTax,
112120
total: "31.20",
113121
totalTax: totalTax,
114122
paymentMethodID: "stripe",
@@ -120,7 +128,7 @@ final class MockOrders {
120128
coupons: [],
121129
refunds: [],
122130
fees: [],
123-
taxes: [makeOrderTaxLine(totalTax: totalTax)]
131+
taxes: [tax]
124132
)
125133
}
126134

@@ -133,14 +141,15 @@ final class MockOrders {
133141
taxes: [])]
134142
}
135143

136-
func makeOrderTaxLine(totalTax: String) -> OrderTaxLine {
144+
func makeOrderTaxLine(totalShippingTax: String,
145+
totalTax: String) -> OrderTaxLine {
137146
.init(taxID: 123,
138147
rateCode: "",
139148
rateID: 1,
140149
label: "State",
141150
isCompoundTaxRate: false,
142151
totalTax: totalTax,
143-
totalShippingTax: "3",
152+
totalShippingTax: totalShippingTax,
144153
ratePercent: 5.5,
145154
attributes: [])
146155
}

Yosemite/YosemiteTests/Stores/ReceiptStoreTests.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ private extension ReceiptStoreTests {
434434
coupons: coupons,
435435
refunds: [],
436436
fees: fees,
437-
taxes: [makeOrderTaxLine(totalTax: totalTax)])
437+
taxes: [makeOrderTaxLine(totalShippingTax: shippingTax, totalTax: totalTax)])
438438
}
439439

440440
func expectedDiscountLineDescription() -> String {
@@ -475,14 +475,15 @@ private extension ReceiptStoreTests {
475475
attributes: [])
476476
}
477477

478-
func makeOrderTaxLine(totalTax: String) -> Yosemite.OrderTaxLine {
478+
func makeOrderTaxLine(totalShippingTax: String,
479+
totalTax: String) -> Yosemite.OrderTaxLine {
479480
.init(taxID: 123,
480481
rateCode: "",
481482
rateID: 1,
482483
label: "State",
483484
isCompoundTaxRate: false,
484485
totalTax: totalTax,
485-
totalShippingTax: "3",
486+
totalShippingTax: totalShippingTax,
486487
ratePercent: 5.5,
487488
attributes: [])
488489
}

0 commit comments

Comments
 (0)