Removing Delivered Notifications (#1305)

* completed

* changelog

* tests

* more tests

* better naming

* fix

* a bit more waiting time

* generated mocks

* xcodegen
This commit is contained in:
Mauro
2023-07-11 10:44:06 +02:00
committed by GitHub
parent 98dabe8500
commit 28fa1140b7
15 changed files with 245 additions and 8 deletions
@@ -22,6 +22,7 @@ class InvitesScreenViewModelTests: XCTestCase {
var viewModel: InvitesScreenViewModelProtocol!
var clientProxy: MockClientProxy!
var userSession: MockUserSession!
var mockNotificationCenter: NotificationCenterMock!
var context: InvitesScreenViewModelType.Context {
viewModel.context
@@ -30,6 +31,7 @@ class InvitesScreenViewModelTests: XCTestCase {
override func setUpWithError() throws {
clientProxy = MockClientProxy(userID: "@a:b.com")
userSession = MockUserSession(clientProxy: clientProxy, mediaProvider: MockMediaProvider())
mockNotificationCenter = NotificationCenterMock()
}
func testEmptyState() async throws {
@@ -72,6 +74,14 @@ class InvitesScreenViewModelTests: XCTestCase {
context.send(viewAction: .decline(.init(roomDetails: details, isUnread: false)))
XCTAssertNotNil(context.alertInfo)
}
func testHasAppeared() async {
setupViewModel()
context.send(viewAction: .appeared)
await Task.yield()
XCTAssertEqual(mockNotificationCenter.postNameObjectReceivedArguments?.aName, .invitesScreenAppeared)
}
// MARK: - Private
@@ -85,6 +95,7 @@ class InvitesScreenViewModelTests: XCTestCase {
viewModel = InvitesScreenViewModel(userSession: userSession,
appSettings: ServiceLocator.shared.settings,
analytics: ServiceLocator.shared.analytics,
userIndicatorController: ServiceLocator.shared.userIndicatorController)
userIndicatorController: ServiceLocator.shared.userIndicatorController,
notificationCenterProtocol: mockNotificationCenter)
}
}