@@ -71,37 +71,6 @@ class PublishSettingsViewControllerTests: CoreDataTestCase {
7171 XCTFail ( " View model should be published instead of \( viewModel. state) " )
7272 }
7373 }
74-
75- /// Tests that our display date is properly formatted and converted
76- func testDisplayDate( ) {
77-
78- let timeZoneOffset = - 1
79-
80- let testDate = Date ( timeIntervalSinceReferenceDate: 0 )
81-
82- let post = PostBuilder ( mainContext) . with ( dateCreated: testDate) . drafted ( ) . withRemote ( ) . build ( )
83-
84- // Set our blog's time zone slightly offset from UTC
85- let newValue = OffsetTimeZone ( offset: Float ( timeZoneOffset) )
86-
87- // Need to use options here instead of blog.settings because BlogService uses those instead of the properties. No idea why.
88- post. blog. options = [ " timezone " : [ " value " : newValue. timezoneString] , " gmt_offset " : [ " value " : newValue. gmtOffset as NSNumber ? ] ]
89-
90- let viewModel = PublishSettingsViewModel ( post: post, context: self . mainContext)
91-
92- // Create a date formatter that converts to the original UTC date
93- let adjustedFormatter = viewModel. dateTimeFormatter. copy ( ) as! DateFormatter
94- adjustedFormatter. timeZone = TimeZone ( secondsFromGMT: 0 )
95-
96- // Generate formatted string and check that converting straight from that string is NOT the same as original date (should be earlier)
97- let formattedString = viewModel. dateTimeFormatter. string ( from: post. dateCreated!)
98- let date = adjustedFormatter. date ( from: formattedString)
99- XCTAssertNotEqual ( date, testDate, " Dates should not be equal " )
100-
101- // Adjust the original date and check that it matches, thus verifying that our formatter is properly formatting
102- let timeZoneAdjustedDate = testDate. addingTimeInterval ( TimeInterval ( timeZoneOffset * 60 * 60 ) )
103- XCTAssertEqual ( timeZoneAdjustedDate, date, " Formatted date string should equal the adjusted date object " )
104- }
10574}
10675
10776extension PublishSettingsViewControllerTests {
0 commit comments