mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
updated SDK and improved report flow
the report flow is now based on the matrix version and the new one will only be used if the SDK checks if the server supports it.
This commit is contained in:
@@ -304,7 +304,6 @@ class HomeScreenViewModelTests: XCTestCase {
|
||||
|
||||
func testDeclineInvite() async throws {
|
||||
setupViewModel(withInvites: true)
|
||||
|
||||
let invitedRoomIDs = context.viewState.rooms.invites.compactMap(\.roomID)
|
||||
appSettings.seenInvites = Set(invitedRoomIDs)
|
||||
XCTAssertEqual(invitedRoomIDs.count, 2)
|
||||
@@ -323,7 +322,7 @@ class HomeScreenViewModelTests: XCTestCase {
|
||||
|
||||
return .invited(roomProxy)
|
||||
}
|
||||
context.viewState.bindings.alertInfo?.secondaryButton?.action?()
|
||||
context.viewState.bindings.alertInfo?.verticalButtons?[0].action?()
|
||||
await fulfillment(of: [rejectExpectation], timeout: 1.0)
|
||||
|
||||
XCTAssertEqual(appSettings.seenInvites, [invitedRoomIDs[1]])
|
||||
@@ -331,6 +330,21 @@ class HomeScreenViewModelTests: XCTestCase {
|
||||
XCTAssertEqual(notificationManager.removeDeliveredMessageNotificationsForReceivedInvocations, [invitedRoomIDs[0]])
|
||||
}
|
||||
|
||||
func testDeclineAndBlockInvite() async throws {
|
||||
setupViewModel(withInvites: true)
|
||||
let invitedRoomIDs = context.viewState.rooms.invites.compactMap(\.roomID)
|
||||
appSettings.seenInvites = Set(invitedRoomIDs)
|
||||
XCTAssertEqual(invitedRoomIDs.count, 2)
|
||||
|
||||
let deferred = deferFulfillment(context.$viewState) { $0.bindings.alertInfo != nil }
|
||||
context.send(viewAction: .declineInvite(roomIdentifier: invitedRoomIDs[0]))
|
||||
try await deferred.fulfill()
|
||||
|
||||
let deferredAction = deferFulfillment(viewModel.actions) { $0 == .presentDeclineAndBlock(userID: RoomMemberProxyMock.mockCharlie.userID, roomID: invitedRoomIDs[0]) }
|
||||
context.viewState.bindings.alertInfo?.secondaryButton?.action?()
|
||||
try await deferredAction.fulfill()
|
||||
}
|
||||
|
||||
// MARK: - Helpers
|
||||
|
||||
private func setupViewModel(securityStatePublisher: CurrentValuePublisher<SessionSecurityState, Never>? = nil, withInvites: Bool = false) {
|
||||
|
||||
@@ -111,8 +111,9 @@ class JoinRoomScreenViewModelTests: XCTestCase {
|
||||
try await deferred.fulfill()
|
||||
}
|
||||
|
||||
func testDeclineAndBlockInviteInteraction() async throws {
|
||||
func testDeclineAndBlockInviteLegacyInteraction() async throws {
|
||||
setupViewModel(mode: .invited)
|
||||
clientProxy.underlyingIsReportRoomSupported = false
|
||||
let expectation = expectation(description: "Wait for the user to be ignored")
|
||||
clientProxy.ignoreUserClosure = { userID in
|
||||
defer { expectation.fulfill() }
|
||||
@@ -124,15 +125,23 @@ class JoinRoomScreenViewModelTests: XCTestCase {
|
||||
|
||||
context.send(viewAction: .declineInviteAndBlock(userID: "@test:matrix.org"))
|
||||
|
||||
try await deferFulfillment(viewModel.context.$viewState) { $0.bindings.alertInfo != nil }.fulfill()
|
||||
XCTAssertEqual(viewModel.context.alertInfo?.id, .declineInviteAndBlock)
|
||||
|
||||
let deferred = deferFulfillment(viewModel.actionsPublisher) { action in
|
||||
action == .dismiss
|
||||
}
|
||||
context.alertInfo?.secondaryButton?.action?()
|
||||
try await deferred.fulfill()
|
||||
|
||||
await fulfillment(of: [expectation], timeout: 10)
|
||||
try await deferred.fulfill()
|
||||
}
|
||||
|
||||
func testDeclineAndBlockInviteInteraction() async throws {
|
||||
setupViewModel(mode: .invited)
|
||||
try await deferFulfillment(viewModel.context.$viewState) { $0.roomDetails != nil }.fulfill()
|
||||
let deferredAction = deferFulfillment(viewModel.actionsPublisher) { $0 == .presentDeclineAndBlock(userID: "@test:matrix.org") }
|
||||
context.send(viewAction: .declineInviteAndBlock(userID: "@test:matrix.org"))
|
||||
try await deferredAction.fulfill()
|
||||
}
|
||||
|
||||
func testForgetRoom() async throws {
|
||||
|
||||
Reference in New Issue
Block a user