mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Membership aware room routes (#2709)
* Remove the invites button when room list invites are enabled * element-hq/element-x-ios/issues/2632 - Handle room permalinks based on their membership state and show the according room joining screens: - modify the room flow coordinator to only take a roomID and be able to decide its own room flows (especially for unjoined rooms) - add support for the new room preview API - have RoomDirectorySearch go through the same paths
This commit is contained in:
@@ -34,13 +34,44 @@ class JoinRoomScreenViewModelTests: XCTestCase {
|
||||
try await deferred.fulfill()
|
||||
}
|
||||
|
||||
func testAcceptInviteInteraction() async throws {
|
||||
setupViewModel()
|
||||
|
||||
let deferred = deferFulfillment(viewModel.actionsPublisher) { $0 == .joined }
|
||||
context.send(viewAction: .acceptInvite)
|
||||
try await deferred.fulfill()
|
||||
}
|
||||
|
||||
func testDeclineInviteInteraction() async throws {
|
||||
setupViewModel()
|
||||
|
||||
try await deferFulfillment(viewModel.context.$viewState) { $0.roomDetails != nil }.fulfill()
|
||||
|
||||
context.send(viewAction: .declineInvite)
|
||||
|
||||
XCTAssertEqual(viewModel.context.alertInfo?.id, .declineInvite)
|
||||
}
|
||||
|
||||
private func setupViewModel(throwing: Bool = false) {
|
||||
let clientProxy = ClientProxyMock(.init())
|
||||
|
||||
clientProxy.joinRoomReturnValue = throwing ? .failure(.sdkError(ClientProxyMockError.generic)) : .success(())
|
||||
|
||||
clientProxy.roomPreviewForIdentifierReturnValue = .success(.init(roomID: "",
|
||||
name: nil,
|
||||
canonicalAlias: nil,
|
||||
topic: nil,
|
||||
avatarURL: nil,
|
||||
memberCount: 0,
|
||||
isHistoryWorldReadable: false,
|
||||
isJoined: false,
|
||||
isInvited: false,
|
||||
isPublic: false,
|
||||
canKnock: false))
|
||||
|
||||
viewModel = JoinRoomScreenViewModel(roomID: "1",
|
||||
roomName: "Room Name",
|
||||
avatarURL: nil,
|
||||
interaction: .join,
|
||||
clientProxy: clientProxy)
|
||||
clientProxy: clientProxy,
|
||||
mediaProvider: MockMediaProvider(),
|
||||
userIndicatorController: ServiceLocator.shared.userIndicatorController)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user