Stop relying on the NotificationCenter for removing delivered push notifications:

- this will improve the architecture but more importantly will remove some very flakey unit tests
This commit is contained in:
Stefan Ceriu
2024-04-12 17:46:37 +03:00
committed by Stefan Ceriu
parent 891315ef04
commit 4d513f9ed1
15 changed files with 113 additions and 147 deletions
@@ -23,6 +23,8 @@ import Combine
class UserSessionFlowCoordinatorTests: XCTestCase {
var userSessionFlowCoordinator: UserSessionFlowCoordinator!
var navigationRootCoordinator: NavigationRootCoordinator!
var notificationManager: NotificationManagerMock!
var cancellables = Set<AnyCancellable>()
var detailCoordinator: CoordinatorProtocol? {
@@ -45,6 +47,8 @@ class UserSessionFlowCoordinatorTests: XCTestCase {
navigationRootCoordinator = NavigationRootCoordinator()
notificationManager = NotificationManagerMock()
userSessionFlowCoordinator = UserSessionFlowCoordinator(userSession: userSession,
navigationRootCoordinator: navigationRootCoordinator,
windowManager: WindowManagerMock(),
@@ -53,7 +57,7 @@ class UserSessionFlowCoordinatorTests: XCTestCase {
roomTimelineControllerFactory: MockRoomTimelineControllerFactory(),
appSettings: ServiceLocator.shared.settings,
analytics: ServiceLocator.shared.analytics,
notificationManager: NotificationManagerMock(),
notificationManager: notificationManager,
isNewLogin: false)
let deferred = deferFulfillment(userSessionFlowCoordinator.statePublisher) { $0 == .roomList(selectedRoomID: nil) }
@@ -81,6 +85,8 @@ class UserSessionFlowCoordinatorTests: XCTestCase {
try await process(route: .roomList, expectedState: .roomList(selectedRoomID: nil))
XCTAssertNil(detailNavigationStack?.rootCoordinator)
XCTAssertNil(detailCoordinator)
XCTAssertEqual(notificationManager.removeDeliveredMessageNotificationsForReceivedInvocations, ["1", "1", "2"])
}
func testRoomDetailsPresentation() async throws {