Add unit test for the in-timeline space permalink handling

This commit is contained in:
Stefan Ceriu
2025-10-08 11:26:36 +03:00
committed by Stefan Ceriu
parent 182b48b42b
commit 334746edb3
3 changed files with 21 additions and 6 deletions

View File

@@ -378,6 +378,19 @@ class RoomFlowCoordinatorTests: XCTestCase {
try await fulfillment.fulfill()
}
// MARK: - Spaces
func testSpacePermalink() async throws {
setupRoomFlowCoordinator()
try await process(route: .room(roomID: "1", via: []))
XCTAssert(navigationStackCoordinator.rootCoordinator is RoomScreenCoordinator)
try await process(route: .childRoom(roomID: "space1", via: []))
XCTAssert(navigationStackCoordinator.rootCoordinator is RoomScreenCoordinator)
XCTAssert(navigationStackCoordinator.stackCoordinators.first is SpaceScreenCoordinator)
}
// MARK: - Private
private func process(route: AppRoute) async throws {
@@ -420,7 +433,9 @@ class RoomFlowCoordinatorTests: XCTestCase {
private func setupRoomFlowCoordinator(asChildFlow: Bool = false, roomType: RoomType? = nil) {
cancellables.removeAll()
clientProxy = ClientProxyMock(.init(userID: "hi@bob", roomSummaryProvider: RoomSummaryProviderMock(.init(state: .loaded(.mockRooms)))))
clientProxy = ClientProxyMock(.init(userID: "hi@bob",
roomSummaryProvider: RoomSummaryProviderMock(.init(state: .loaded(.mockRooms))),
spaceServiceConfiguration: .populated))
timelineControllerFactory = TimelineControllerFactoryMock(.init())
clientProxy.roomPreviewForIdentifierViaClosure = { [roomType] roomID, _ in