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 {
27
27
)
28
28
}
29
29
30
- func testDateFormatterUses_YYYY_MM_dd_Format ( ) throws {
30
+ func testDateFormatterUses_yyyy_MM_dd_Format ( ) throws {
31
31
// Given
32
32
let date = Date ( timeIntervalSince1970: 1_635_739_200 ) // 2021-11-01
33
33
// When
@@ -36,6 +36,17 @@ class HeartbeatsPayloadTests: XCTestCase {
36
36
XCTAssertEqual ( dateString, " 2021-11-01 " )
37
37
}
38
38
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
+
39
50
func testEncodeAndDecode( ) throws {
40
51
// Given
41
52
let heartbeatsPayload = HeartbeatsPayload (
You can’t perform that action at this time.
0 commit comments