|
|
|
@ -76,4 +76,32 @@ class EventInfoTests: XCTestCase {
|
|
|
|
|
XCTAssert(mockEventInfo.metadataForMeeting() == "in 25h", |
|
|
|
|
"Metadata for meeting: \(mockEventInfo.metadataForMeeting()) doesn't match expectation") |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func testMetadataForEventHappeningAfterAnHour() throws { |
|
|
|
|
let pastChunk = TimeChunk(seconds: 10, minutes: 10, hours: 1, days: 0, weeks: 0, months: 0, years: 0) |
|
|
|
|
let mockEvent = EKEvent(eventStore: eventStore) |
|
|
|
|
mockEvent.title = "Mock Title" |
|
|
|
|
mockEvent.startDate = Date().add(pastChunk) |
|
|
|
|
|
|
|
|
|
let mockEventInfo = EventInfo(event: mockEvent, |
|
|
|
|
isAllDay: false, |
|
|
|
|
meetingURL: nil, |
|
|
|
|
attendeStatus: .accepted) |
|
|
|
|
XCTAssert(mockEventInfo.metadataForMeeting() == "in 1h", |
|
|
|
|
"Metadata for meeting: \(mockEventInfo.metadataForMeeting()) doesn't match expectation") |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func testMetadataForEventHappeningAfterThreeHours() throws { |
|
|
|
|
let pastChunk = TimeChunk(seconds: 10, minutes: 10, hours: 3, days: 0, weeks: 0, months: 0, years: 0) |
|
|
|
|
let mockEvent = EKEvent(eventStore: eventStore) |
|
|
|
|
mockEvent.title = "Mock Title" |
|
|
|
|
mockEvent.startDate = Date().add(pastChunk) |
|
|
|
|
|
|
|
|
|
let mockEventInfo = EventInfo(event: mockEvent, |
|
|
|
|
isAllDay: false, |
|
|
|
|
meetingURL: nil, |
|
|
|
|
attendeStatus: .accepted) |
|
|
|
|
XCTAssert(mockEventInfo.metadataForMeeting() == "in 3h", |
|
|
|
|
"Metadata for meeting: \(mockEventInfo.metadataForMeeting()) doesn't match expectation") |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|