Fix NotificationGroupTests not compiling
This commit is contained in:
parent
e469d207b4
commit
572c5a0824
|
@ -197,72 +197,72 @@ class NotificationGroupTests: XCTestCase {
|
||||||
|
|
||||||
func testGroupSimple() {
|
func testGroupSimple() {
|
||||||
let groups = NotificationGroup.createGroups(notifications: [likeA1, likeA2], only: [.favourite])
|
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() {
|
func testGroupWithOtherGroupableInBetween() {
|
||||||
let groups = NotificationGroup.createGroups(notifications: [likeA1, likeB, likeA2], only: [.favourite])
|
let groups = NotificationGroup.createGroups(notifications: [likeA1, likeB, likeA2], only: [.favourite])
|
||||||
XCTAssertEqual(groups, [
|
XCTAssertEqual(groups, [
|
||||||
NotificationGroup(notifications: [likeA1, likeA2])!,
|
NotificationGroup(notifications: [likeA1, likeA2], kind: .favourite)!,
|
||||||
NotificationGroup(notifications: [likeB])!,
|
NotificationGroup(notifications: [likeB], kind: .favourite)!,
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
func testDontGroupWithUngroupableInBetween() {
|
func testDontGroupWithUngroupableInBetween() {
|
||||||
let groups = NotificationGroup.createGroups(notifications: [likeA1, mentionB, likeA2], only: [.favourite])
|
let groups = NotificationGroup.createGroups(notifications: [likeA1, mentionB, likeA2], only: [.favourite])
|
||||||
XCTAssertEqual(groups, [
|
XCTAssertEqual(groups, [
|
||||||
NotificationGroup(notifications: [likeA1])!,
|
NotificationGroup(notifications: [likeA1], kind: .favourite)!,
|
||||||
NotificationGroup(notifications: [mentionB])!,
|
NotificationGroup(notifications: [mentionB], kind: .mention)!,
|
||||||
NotificationGroup(notifications: [likeA2])!,
|
NotificationGroup(notifications: [likeA2], kind: .favourite)!,
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
func testMergeSimpleGroups() {
|
func testMergeSimpleGroups() {
|
||||||
let group1 = NotificationGroup(notifications: [likeA1])!
|
let group1 = NotificationGroup(notifications: [likeA1], kind: .favourite)!
|
||||||
let group2 = NotificationGroup(notifications: [likeA2])!
|
let group2 = NotificationGroup(notifications: [likeA2], kind: .favourite)!
|
||||||
let merged = NotificationGroup.mergeGroups(first: [group1], second: [group2], only: [.favourite])
|
let merged = NotificationGroup.mergeGroups(first: [group1], second: [group2], only: [.favourite])
|
||||||
XCTAssertEqual(merged, [
|
XCTAssertEqual(merged, [
|
||||||
NotificationGroup(notifications: [likeA1, likeA2])!
|
NotificationGroup(notifications: [likeA1, likeA2], kind: .favourite)!
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
func testMergeGroupsWithOtherGroupableInBetween() {
|
func testMergeGroupsWithOtherGroupableInBetween() {
|
||||||
let group1 = NotificationGroup(notifications: [likeA1])!
|
let group1 = NotificationGroup(notifications: [likeA1], kind: .favourite)!
|
||||||
let group2 = NotificationGroup(notifications: [likeB])!
|
let group2 = NotificationGroup(notifications: [likeB], kind: .favourite)!
|
||||||
let group3 = NotificationGroup(notifications: [likeA2])!
|
let group3 = NotificationGroup(notifications: [likeA2], kind: .favourite)!
|
||||||
let merged = NotificationGroup.mergeGroups(first: [group1, group2], second: [group3], only: [.favourite])
|
let merged = NotificationGroup.mergeGroups(first: [group1, group2], second: [group3], only: [.favourite])
|
||||||
XCTAssertEqual(merged, [
|
XCTAssertEqual(merged, [
|
||||||
NotificationGroup(notifications: [likeA1, likeA2])!,
|
NotificationGroup(notifications: [likeA1, likeA2], kind: .favourite)!,
|
||||||
NotificationGroup(notifications: [likeB])!,
|
NotificationGroup(notifications: [likeB], kind: .favourite)!,
|
||||||
])
|
])
|
||||||
|
|
||||||
let merged2 = NotificationGroup.mergeGroups(first: [group1], second: [group2, group3], only: [.favourite])
|
let merged2 = NotificationGroup.mergeGroups(first: [group1], second: [group2, group3], only: [.favourite])
|
||||||
XCTAssertEqual(merged2, [
|
XCTAssertEqual(merged2, [
|
||||||
NotificationGroup(notifications: [likeA1, likeA2])!,
|
NotificationGroup(notifications: [likeA1, likeA2], kind: .favourite)!,
|
||||||
NotificationGroup(notifications: [likeB])!,
|
NotificationGroup(notifications: [likeB], kind: .favourite)!,
|
||||||
])
|
])
|
||||||
|
|
||||||
let group4 = NotificationGroup(notifications: [likeB2])!
|
let group4 = NotificationGroup(notifications: [likeB2], kind: .favourite)!
|
||||||
let group5 = NotificationGroup(notifications: [mentionB])!
|
let group5 = NotificationGroup(notifications: [mentionB], kind: .mention)!
|
||||||
let merged3 = NotificationGroup.mergeGroups(first: [group1, group5, group2], second: [group4, group3], only: [.favourite])
|
let merged3 = NotificationGroup.mergeGroups(first: [group1, group5, group2], second: [group4, group3], only: [.favourite])
|
||||||
print(merged3.count)
|
print(merged3.count)
|
||||||
XCTAssertEqual(merged3, [
|
XCTAssertEqual(merged3, [
|
||||||
group1,
|
group1,
|
||||||
group5,
|
group5,
|
||||||
NotificationGroup(notifications: [likeB, likeB2]),
|
NotificationGroup(notifications: [likeB, likeB2], kind: .favourite),
|
||||||
group3
|
group3
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
func testDontMergeWithUngroupableInBetween() {
|
func testDontMergeWithUngroupableInBetween() {
|
||||||
let group1 = NotificationGroup(notifications: [likeA1])!
|
let group1 = NotificationGroup(notifications: [likeA1], kind: .favourite)!
|
||||||
let group2 = NotificationGroup(notifications: [mentionB])!
|
let group2 = NotificationGroup(notifications: [mentionB], kind: .mention)!
|
||||||
let group3 = NotificationGroup(notifications: [likeA2])!
|
let group3 = NotificationGroup(notifications: [likeA2], kind: .favourite)!
|
||||||
let merged = NotificationGroup.mergeGroups(first: [group1, group2], second: [group3], only: [.favourite])
|
let merged = NotificationGroup.mergeGroups(first: [group1, group2], second: [group3], only: [.favourite])
|
||||||
XCTAssertEqual(merged, [
|
XCTAssertEqual(merged, [
|
||||||
NotificationGroup(notifications: [likeA1])!,
|
NotificationGroup(notifications: [likeA1], kind: .favourite)!,
|
||||||
NotificationGroup(notifications: [mentionB])!,
|
NotificationGroup(notifications: [mentionB], kind: .mention)!,
|
||||||
NotificationGroup(notifications: [likeA2])!,
|
NotificationGroup(notifications: [likeA2], kind: .favourite)!,
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue