Просмотр исходного кода

Fix testThatDatesCanBeEncodedAsFormatted test fails due to current calendar mismatches with expected result (#3858)

### Goals :soccer:
Currently test function `testThatDatesCanBeEncodedAsFormatted` fails
when trying to run tests from simulator that is not using Gregorian
calendar while the assertion is expecting date in Gregorian format. The
goal should be running tests passed for all simulator calendar settings.

### Implementation Details :construction:
Force `DateFormatter` in the test function
`testThatDatesCanBeEncodedAsFormatted` to be Gregorian so that it will
be run tests passed for all simulator calendar settings.
Kittisak Phetrungnapha 1 год назад
Родитель
Сommit
c22c45e6af
1 измененных файлов с 1 добавлено и 0 удалено
  1. 1 0
      Tests/ParameterEncoderTests.swift

+ 1 - 0
Tests/ParameterEncoderTests.swift

@@ -730,6 +730,7 @@ final class URLEncodedFormEncoderTests: BaseTestCase {
         let dateFormatter = DateFormatter()
         dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss.SSSS"
         dateFormatter.timeZone = TimeZone(secondsFromGMT: 0)
+        dateFormatter.calendar = Calendar(identifier: .gregorian)
 
         let encoder = URLEncodedFormEncoder(dateEncoding: .formatted(dateFormatter))
         let parameters = ["date": Date(timeIntervalSinceReferenceDate: 123.456)]