-
-
Notifications
You must be signed in to change notification settings - Fork 269
Expand file tree
/
Copy pathGCEventStoreTests.swift
More file actions
59 lines (47 loc) · 1.7 KB
/
GCEventStoreTests.swift
File metadata and controls
59 lines (47 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//
// GCEventStoreTests.swift
// MeetingBarTests
//
import XCTest
@testable import MeetingBar
final class GCEventStoreTests: XCTestCase {
private let calendar = MBCalendar(title: "Test", id: "test", source: nil, email: nil, color: .black)
private func baseItem() -> [String: Any] {
[
"id": "evt1",
"start": ["dateTime": "2025-01-01T10:00:00Z"],
"end": ["dateTime": "2025-01-01T11:00:00Z"]
]
}
func testParsesGoogleDocAttachmentAsMeetingNotes() {
var item = baseItem()
item["attachments"] = [
[
"fileUrl": "https://docs.google.com/document/d/abc123/edit",
"title": "Standup - Notes",
"mimeType": "application/vnd.google-apps.document",
"fileId": "abc123"
]
]
let event = GCEventStore.GCParser.event(from: item, calendar: calendar)
XCTAssertEqual(event?.meetingNotesDocLink?.absoluteString,
"https://docs.google.com/document/d/abc123/edit")
}
func testIgnoresNonDocumentAttachment() {
var item = baseItem()
item["attachments"] = [
[
"fileUrl": "https://drive.google.com/file/d/xyz/view",
"title": "Slides.pdf",
"mimeType": "application/pdf",
"fileId": "xyz"
]
]
let event = GCEventStore.GCParser.event(from: item, calendar: calendar)
XCTAssertNil(event?.meetingNotesDocLink)
}
func testNoAttachmentsLeavesMeetingNotesNil() {
let event = GCEventStore.GCParser.event(from: baseItem(), calendar: calendar)
XCTAssertNil(event?.meetingNotesDocLink)
}
}