mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Tweak internal/external deeplink handling (#2664)
* Add a childRoom AppRoute. * Add a tests for child room routes.
This commit is contained in:
@@ -72,6 +72,30 @@ class RoomFlowCoordinatorTests: XCTestCase {
|
||||
XCTAssert(navigationStackCoordinator.stackCoordinators.first is RoomDetailsScreenCoordinator)
|
||||
}
|
||||
|
||||
func testChildRoomFlow() async throws {
|
||||
await setupViewModel()
|
||||
|
||||
try await process(route: .room(roomID: "1"))
|
||||
XCTAssert(navigationStackCoordinator.rootCoordinator is RoomScreenCoordinator)
|
||||
XCTAssertEqual(navigationStackCoordinator.stackCoordinators.count, 0)
|
||||
|
||||
try await process(route: .childRoom(roomID: "2"))
|
||||
try await Task.sleep(for: .milliseconds(100))
|
||||
XCTAssertEqual(navigationStackCoordinator.stackCoordinators.count, 1)
|
||||
XCTAssert(navigationStackCoordinator.stackCoordinators.first is RoomScreenCoordinator)
|
||||
|
||||
try await process(route: .childRoom(roomID: "3"))
|
||||
try await Task.sleep(for: .milliseconds(100))
|
||||
XCTAssertEqual(navigationStackCoordinator.stackCoordinators.count, 2)
|
||||
XCTAssert(navigationStackCoordinator.stackCoordinators.first is RoomScreenCoordinator)
|
||||
XCTAssert(navigationStackCoordinator.stackCoordinators.last is RoomScreenCoordinator)
|
||||
|
||||
try await process(route: .roomList, expectedAction: .finished)
|
||||
XCTAssertNil(navigationStackCoordinator.rootCoordinator)
|
||||
XCTAssertEqual(navigationStackCoordinator.stackCoordinators.count, 0)
|
||||
}
|
||||
|
||||
/// Tests the child flow teardown in isolation of it's parent.
|
||||
func testChildFlowTearDown() async throws {
|
||||
await setupViewModel(asChildFlow: true)
|
||||
navigationStackCoordinator.setRootCoordinator(BlankFormCoordinator())
|
||||
@@ -90,6 +114,24 @@ class RoomFlowCoordinatorTests: XCTestCase {
|
||||
XCTAssertTrue(navigationStackCoordinator.stackCoordinators.last is RoomDetailsScreenCoordinator, "A child room flow should leave its parent to clean up the stack.")
|
||||
}
|
||||
|
||||
func testChildRoomMemberDetails() async throws {
|
||||
await setupViewModel()
|
||||
|
||||
try await process(route: .room(roomID: "1"))
|
||||
XCTAssert(navigationStackCoordinator.rootCoordinator is RoomScreenCoordinator)
|
||||
XCTAssertEqual(navigationStackCoordinator.stackCoordinators.count, 0)
|
||||
|
||||
try await process(route: .childRoom(roomID: "2"))
|
||||
try await Task.sleep(for: .milliseconds(100))
|
||||
XCTAssertEqual(navigationStackCoordinator.stackCoordinators.count, 1)
|
||||
XCTAssert(navigationStackCoordinator.stackCoordinators.first is RoomScreenCoordinator)
|
||||
|
||||
try await process(route: .roomMemberDetails(userID: RoomMemberProxyMock.mockMe.userID))
|
||||
XCTAssertEqual(navigationStackCoordinator.stackCoordinators.count, 2)
|
||||
XCTAssert(navigationStackCoordinator.stackCoordinators.first is RoomScreenCoordinator)
|
||||
XCTAssert(navigationStackCoordinator.stackCoordinators.last is RoomMemberDetailsScreenCoordinator)
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
private func process(route: AppRoute) async throws {
|
||||
|
||||
Reference in New Issue
Block a user