mirror of
https://github.com/MessageKit/MessageKit.git
synced 2026-02-06 19:03:19 +00:00
Merge pull request #437 from zhongwuzw/fix-tests
Fix tests failure when last week is the last year
This commit is contained in:
@@ -93,7 +93,13 @@ class MessageKitDateFormatterTests: XCTestCase {
|
||||
|
||||
///Day of last week
|
||||
startOfWeek = (Calendar.current as NSCalendar).date(byAdding: .day, value: -2, to: startOfWeek, options: [])!
|
||||
formatter.dateFormat = "E, d MMM, h:mm a"
|
||||
|
||||
if Calendar.current.isDate(startOfWeek, equalTo: Date(), toGranularity: .year) {
|
||||
formatter.dateFormat = "E, d MMM, h:mm a"
|
||||
} else {
|
||||
formatter.dateFormat = "MMM d, yyyy, h:mm a"
|
||||
}
|
||||
|
||||
XCTAssertEqual(MessageKitDateFormatter.shared.string(from: startOfWeek), formatter.string(from: startOfWeek))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user