I have a swift package with a function that formats a HKQuantity using the current locale. I want to write a unit test with all locales the package is localized for. I do not want to insert a separate locale parameter, I want to test the function with the current locale as I use the function only with the current locale.
Can I set the current locale for this use case in the code somehow?
Example:
do {
let quantity = HKQuantity(unit: unit, doubleValue: 0.955)
let result = quantity.formattedAsOxygenSaturation(precision: .better)
let expectedResult = "95.5 %"
XCTAssertEqual(result, expectedResult)
}
Thanks!