mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-05 03:48:27 +00:00
Add the JoinRoomScreen into the SpaceFlowCoordinator. (#4513)
* Add the JoinRoomScreen into the SpaceFlowCoordinator. The screen needs further work to make the join work. * Fix the tests completing the join flow with the right action.
This commit is contained in:
@@ -47,7 +47,7 @@ class JoinRoomScreenViewModelTests: XCTestCase {
|
||||
|
||||
XCTAssertTrue(appSettings.seenInvites.isEmpty, "Only an invited room should register the room ID as a seen invite.")
|
||||
|
||||
let deferred = deferFulfillment(viewModel.actionsPublisher) { $0 == .joined }
|
||||
let deferred = deferFulfillment(viewModel.actionsPublisher) { $0 == .joined(.roomID("1")) }
|
||||
context.send(viewAction: .join)
|
||||
try await deferred.fulfill()
|
||||
}
|
||||
@@ -60,7 +60,7 @@ class JoinRoomScreenViewModelTests: XCTestCase {
|
||||
|
||||
XCTAssertEqual(appSettings.seenInvites, ["1"], "The invited room's ID should be registered as a seen invite.")
|
||||
|
||||
let deferred = deferFulfillment(viewModel.actionsPublisher) { $0 == .joined }
|
||||
let deferred = deferFulfillment(viewModel.actionsPublisher) { $0 == .joined(.roomID("1")) }
|
||||
context.send(viewAction: .acceptInvite)
|
||||
try await deferred.fulfill()
|
||||
|
||||
@@ -156,6 +156,8 @@ class JoinRoomScreenViewModelTests: XCTestCase {
|
||||
try await deferred.fulfill()
|
||||
}
|
||||
|
||||
// MARK: - Helpers
|
||||
|
||||
private func setupViewModel(throwing: Bool = false, mode: TestMode = .joined) {
|
||||
ServiceLocator.shared.settings.knockingEnabled = true
|
||||
|
||||
@@ -199,3 +201,21 @@ class JoinRoomScreenViewModelTests: XCTestCase {
|
||||
userIndicatorController: ServiceLocator.shared.userIndicatorController)
|
||||
}
|
||||
}
|
||||
|
||||
extension JoinRoomScreenViewModelAction: @retroactive Equatable {
|
||||
// A close enough approximation for tests.
|
||||
public static func == (lhs: JoinRoomScreenViewModelAction, rhs: JoinRoomScreenViewModelAction) -> Bool {
|
||||
switch (lhs, rhs) {
|
||||
case (.joined(.roomID(let lhsRoomID)), .joined(.roomID(let rhsRoomID))):
|
||||
lhsRoomID == rhsRoomID
|
||||
case (.joined(.space(let lhsSpace)), .joined(.space(let rhsSpace))):
|
||||
lhsSpace.spaceRoomProxy.id == rhsSpace.spaceRoomProxy.id
|
||||
case (.dismiss, .dismiss):
|
||||
true
|
||||
case (.presentDeclineAndBlock(let lhsUserID), .presentDeclineAndBlock(let rhsUserID)):
|
||||
lhsUserID == rhsUserID
|
||||
default:
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user