File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
FirebaseCore/Internal/Tests/Unit Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ class HeartbeatsPayloadTests: XCTestCase {
2727 )
2828 }
2929
30- func testDateFormatterUses_YYYY_MM_dd_Format ( ) throws {
30+ func testDateFormatterUses_yyyy_MM_dd_Format ( ) throws {
3131 // Given
3232 let date = Date ( timeIntervalSince1970: 1_635_739_200 ) // 2021-11-01
3333 // When
@@ -36,6 +36,17 @@ class HeartbeatsPayloadTests: XCTestCase {
3636 XCTAssertEqual ( dateString, " 2021-11-01 " )
3737 }
3838
39+ func testDateFormatterDoesNotUseWeekYear( ) throws {
40+ // Given
41+ // The "week year" of `2018-12-31` is 2019, so we want to ensure that such
42+ // dates are formatted using the "calendar year" (2018).
43+ let date = Date ( timeIntervalSince1970: 1_546_275_600 ) // 2018-12-31
44+ // When
45+ let dateString = HeartbeatsPayload . dateFormatter. string ( from: date)
46+ // Then
47+ XCTAssertEqual ( dateString, " 2018-12-31 " )
48+ }
49+
3950 func testEncodeAndDecode( ) throws {
4051 // Given
4152 let heartbeatsPayload = HeartbeatsPayload (
You can’t perform that action at this time.
0 commit comments