Skip to content

Commit ea87d95

Browse files
committed
Assert the correct localized date string based on OS version
On iOS 16, `DateFormatter` returns a different localized string for template format 'MMM d, h:mm a', compared to previous iOS versions. Feeback to Apple: FB11335645.
1 parent 750f5f8 commit ea87d95

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

WooCommerce/WooCommerceTests/ViewRelated/Dashboard/Stats V4/StoreStatsPeriodViewModelTests.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,11 @@ final class StoreStatsPeriodViewModelTests: XCTestCase {
341341
viewModel.selectedIntervalIndex = 0
342342

343343
// Then
344-
XCTAssertEqual(timeRangeBarViewModels.map { $0.timeRangeText }, ["Monday, Jan 3", "Monday, Jan 3, 1:00 AM"])
344+
if #available(iOS 16.0, *) {
345+
XCTAssertEqual(timeRangeBarViewModels.map { $0.timeRangeText }, ["Monday, Jan 3", "Monday, Jan 3 at 1:00 AM"])
346+
} else {
347+
XCTAssertEqual(timeRangeBarViewModels.map { $0.timeRangeText }, ["Monday, Jan 3", "Monday, Jan 3, 1:00 AM"])
348+
}
345349
}
346350

347351
func test_timeRangeBarViewModel_for_thisWeek_is_emitted_twice_after_order_and_visitor_stats_updated_and_selecting_interval() {

0 commit comments

Comments
 (0)