Browse Source

Fix Event Info tests.

master
Abhishek Banthia 9 months ago
parent
commit
30a7454879
  1. 2
      Clocker/ClockerUnitTests/EventInfoTests.swift
  2. 4
      Clocker/Events and Reminders/CalendarHandler.swift

2
Clocker/ClockerUnitTests/EventInfoTests.swift

@ -59,7 +59,7 @@ class EventInfoTests: XCTestCase {
isAllDay: false, isAllDay: false,
meetingURL: nil, meetingURL: nil,
attendeStatus: .accepted) attendeStatus: .accepted)
XCTAssert(mockEventInfo.metadataForMeeting() == "Error", XCTAssert(mockEventInfo.metadataForMeeting() == "started.",
"Metadata for meeting: \(mockEventInfo.metadataForMeeting()) doesn't match expectation") "Metadata for meeting: \(mockEventInfo.metadataForMeeting()) doesn't match expectation")
} }

4
Clocker/Events and Reminders/CalendarHandler.swift

@ -494,7 +494,7 @@ struct EventInfo {
let timeIntervalSinceNowForMeeting = event.startDate.timeIntervalSinceNow let timeIntervalSinceNowForMeeting = event.startDate.timeIntervalSinceNow
if timeIntervalSinceNowForMeeting <= 0 || event.startDate.shortTimeAgoSinceNow == "0s" { if timeIntervalSinceNowForMeeting == 0 || event.startDate.shortTimeAgoSinceNow == "0s" {
return "started." return "started."
} else if timeIntervalSinceNowForMeeting < 0, timeIntervalSinceNowForMeeting > -300 { } else if timeIntervalSinceNowForMeeting < 0, timeIntervalSinceNowForMeeting > -300 {
return "started +\(event.startDate.shortTimeAgoSinceNow)." return "started +\(event.startDate.shortTimeAgoSinceNow)."
@ -520,6 +520,6 @@ struct EventInfo {
return "in \(hoursUntil)h" return "in \(hoursUntil)h"
} }
return "Error" return "started."
} }
} }

Loading…
Cancel
Save