Skip to content

Commit de32f9a

Browse files
committed
OrderSearchStarterVM: Revert empty string and return 0 for total
This matches Android's behavior.
1 parent 925420b commit de32f9a

File tree

2 files changed

+1
-16
lines changed

2 files changed

+1
-16
lines changed

WooCommerce/Classes/ViewRelated/Search/Order/OrderSearchStarterViewModel.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ extension OrderSearchStarterViewModel {
8383
func cellViewModel(at indexPath: IndexPath) -> CellViewModel {
8484
let orderStatus = resultsController.object(at: indexPath)
8585

86-
let total = orderStatus.total > 0 ? NumberFormatter.localizedUpToNinetyNine(orderStatus.total) : ""
86+
let total = NumberFormatter.localizedUpToNinetyNine(orderStatus.total)
8787

8888
return CellViewModel(name: orderStatus.name ?? "",
8989
slug: orderStatus.slug,

WooCommerce/WooCommerceTests/ViewRelated/Search/Order/OrderSearchStarterViewModelTests.swift

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -104,21 +104,6 @@ final class OrderSearchStarterViewModelTests: XCTestCase {
104104
// Then
105105
XCTAssertEqual(cellViewModel.total, NSLocalizedString("99+", comment: ""))
106106
}
107-
108-
func testGivenAnOrderStatusTotalOfZeroItReturnsAnEmptyString() {
109-
// Given
110-
let viewModel = OrderSearchStarterViewModel(siteID: siteID, storageManager: storageManager)
111-
112-
insert(OrderStatus(name: "Processing", siteID: siteID, slug: "slug", total: 0))
113-
114-
viewModel.activateAndForwardUpdates(to: UITableView())
115-
116-
// When
117-
let cellViewModel = viewModel.cellViewModel(at: IndexPath(row: 0, section: 0))
118-
119-
// Then
120-
XCTAssertEqual(cellViewModel.total, "")
121-
}
122107
}
123108

124109
// MARK: - Helpers

0 commit comments

Comments
 (0)