Fix NotificationGroupTests not compiling

This commit is contained in:
Shadowfacts 2024-12-15 13:52:26 -05:00
parent e469d207b4
commit 572c5a0824
1 changed files with 25 additions and 25 deletions

View File

@ -197,72 +197,72 @@ class NotificationGroupTests: XCTestCase {
func testGroupSimple() {
let groups = NotificationGroup.createGroups(notifications: [likeA1, likeA2], only: [.favourite])
XCTAssertEqual(groups, [NotificationGroup(notifications: [likeA1, likeA2])!])
XCTAssertEqual(groups, [NotificationGroup(notifications: [likeA1, likeA2], kind: .favourite)!])
}
func testGroupWithOtherGroupableInBetween() {
let groups = NotificationGroup.createGroups(notifications: [likeA1, likeB, likeA2], only: [.favourite])
XCTAssertEqual(groups, [
NotificationGroup(notifications: [likeA1, likeA2])!,
NotificationGroup(notifications: [likeB])!,
NotificationGroup(notifications: [likeA1, likeA2], kind: .favourite)!,
NotificationGroup(notifications: [likeB], kind: .favourite)!,
])
}
func testDontGroupWithUngroupableInBetween() {
let groups = NotificationGroup.createGroups(notifications: [likeA1, mentionB, likeA2], only: [.favourite])
XCTAssertEqual(groups, [
NotificationGroup(notifications: [likeA1])!,
NotificationGroup(notifications: [mentionB])!,
NotificationGroup(notifications: [likeA2])!,
NotificationGroup(notifications: [likeA1], kind: .favourite)!,
NotificationGroup(notifications: [mentionB], kind: .mention)!,
NotificationGroup(notifications: [likeA2], kind: .favourite)!,
])
}
func testMergeSimpleGroups() {
let group1 = NotificationGroup(notifications: [likeA1])!
let group2 = NotificationGroup(notifications: [likeA2])!
let group1 = NotificationGroup(notifications: [likeA1], kind: .favourite)!
let group2 = NotificationGroup(notifications: [likeA2], kind: .favourite)!
let merged = NotificationGroup.mergeGroups(first: [group1], second: [group2], only: [.favourite])
XCTAssertEqual(merged, [
NotificationGroup(notifications: [likeA1, likeA2])!
NotificationGroup(notifications: [likeA1, likeA2], kind: .favourite)!
])
}
func testMergeGroupsWithOtherGroupableInBetween() {
let group1 = NotificationGroup(notifications: [likeA1])!
let group2 = NotificationGroup(notifications: [likeB])!
let group3 = NotificationGroup(notifications: [likeA2])!
let group1 = NotificationGroup(notifications: [likeA1], kind: .favourite)!
let group2 = NotificationGroup(notifications: [likeB], kind: .favourite)!
let group3 = NotificationGroup(notifications: [likeA2], kind: .favourite)!
let merged = NotificationGroup.mergeGroups(first: [group1, group2], second: [group3], only: [.favourite])
XCTAssertEqual(merged, [
NotificationGroup(notifications: [likeA1, likeA2])!,
NotificationGroup(notifications: [likeB])!,
NotificationGroup(notifications: [likeA1, likeA2], kind: .favourite)!,
NotificationGroup(notifications: [likeB], kind: .favourite)!,
])
let merged2 = NotificationGroup.mergeGroups(first: [group1], second: [group2, group3], only: [.favourite])
XCTAssertEqual(merged2, [
NotificationGroup(notifications: [likeA1, likeA2])!,
NotificationGroup(notifications: [likeB])!,
NotificationGroup(notifications: [likeA1, likeA2], kind: .favourite)!,
NotificationGroup(notifications: [likeB], kind: .favourite)!,
])
let group4 = NotificationGroup(notifications: [likeB2])!
let group5 = NotificationGroup(notifications: [mentionB])!
let group4 = NotificationGroup(notifications: [likeB2], kind: .favourite)!
let group5 = NotificationGroup(notifications: [mentionB], kind: .mention)!
let merged3 = NotificationGroup.mergeGroups(first: [group1, group5, group2], second: [group4, group3], only: [.favourite])
print(merged3.count)
XCTAssertEqual(merged3, [
group1,
group5,
NotificationGroup(notifications: [likeB, likeB2]),
NotificationGroup(notifications: [likeB, likeB2], kind: .favourite),
group3
])
}
func testDontMergeWithUngroupableInBetween() {
let group1 = NotificationGroup(notifications: [likeA1])!
let group2 = NotificationGroup(notifications: [mentionB])!
let group3 = NotificationGroup(notifications: [likeA2])!
let group1 = NotificationGroup(notifications: [likeA1], kind: .favourite)!
let group2 = NotificationGroup(notifications: [mentionB], kind: .mention)!
let group3 = NotificationGroup(notifications: [likeA2], kind: .favourite)!
let merged = NotificationGroup.mergeGroups(first: [group1, group2], second: [group3], only: [.favourite])
XCTAssertEqual(merged, [
NotificationGroup(notifications: [likeA1])!,
NotificationGroup(notifications: [mentionB])!,
NotificationGroup(notifications: [likeA2])!,
NotificationGroup(notifications: [likeA1], kind: .favourite)!,
NotificationGroup(notifications: [mentionB], kind: .mention)!,
NotificationGroup(notifications: [likeA2], kind: .favourite)!,
])
}