Skip to content

Commit

Permalink
Fix testThatDatesCanBeEncodedAsFormatted test fails due to current ca…
Browse files Browse the repository at this point in the history
…lendar mismatches with expected result (#3858)

### Goals ⚽
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 🚧
Force `DateFormatter` in the test function
`testThatDatesCanBeEncodedAsFormatted` to be Gregorian so that it will
be run tests passed for all simulator calendar settings.
  • Loading branch information
kittisak-phetrungnapha committed May 11, 2024
1 parent f455c29 commit c22c45e
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions Tests/ParameterEncoderTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down

0 comments on commit c22c45e

Please sign in to comment.