From 8f0bacdccd5df715c5240e24377d43d5ae5f4f16 Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Fri, 24 May 2024 09:16:33 -0700 Subject: [PATCH] Fix failing test for 24 hr locales (#44) This test was failing for me. I use en-US locale, but I set my clock to 24 hour. It's admittedly uncommon, but I'd wager this test is failing for anyone in a non-12 hours locale. To be honest, I expected the existing date format string `hh:mm a` to be sufficient, but apparently its not. --- MapboxNavigationTests/Sources/Tests/StyleManagerTests.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MapboxNavigationTests/Sources/Tests/StyleManagerTests.swift b/MapboxNavigationTests/Sources/Tests/StyleManagerTests.swift index f79676d3..a6d0a1c8 100644 --- a/MapboxNavigationTests/Sources/Tests/StyleManagerTests.swift +++ b/MapboxNavigationTests/Sources/Tests/StyleManagerTests.swift @@ -80,7 +80,8 @@ class StyleManagerTests: XCTestCase { let dateFormatter = DateFormatter() dateFormatter.dateFormat = "hh:mm a" dateFormatter.timeZone = TimeZone(identifier: "PST") - + dateFormatter.locale = Locale(identifier: "en_US") + NSTimeZone.default = NSTimeZone(abbreviation: "PST")! as TimeZone let beforeSunrise = dateFormatter.date(from: "05:00 AM")!