mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
fixed existing tests and added tests for all the threaded flows
This commit is contained in:
@@ -173,8 +173,9 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
|
||||
if case .thread(threadRootEventID: threadRootEventID, _) = stateMachine.state, let threadCoordinator = childThreads.last {
|
||||
threadCoordinator.focusOnEvent(eventID: eventID)
|
||||
} else {
|
||||
// If we are showing the room timeline, we want to focus the thread root
|
||||
if childThreads.isEmpty {
|
||||
roomScreenCoordinator?.focusOnEvent(.init(eventID: eventID, shouldSetPin: false))
|
||||
roomScreenCoordinator?.focusOnEvent(.init(eventID: threadRootEventID, shouldSetPin: false))
|
||||
}
|
||||
stateMachine.tryEvent(.presentThread(threadRootEventID: threadRootEventID, focusEventID: eventID))
|
||||
}
|
||||
|
||||
@@ -96,11 +96,15 @@ extension ClientProxyMock {
|
||||
|
||||
roomForIdentifierClosure = { [weak self] identifier in
|
||||
if let room = self?.roomSummaryProvider.roomListPublisher.value.first(where: { $0.id == identifier }) {
|
||||
await .joined(JoinedRoomProxyMock(.init(id: room.id, name: room.name)))
|
||||
let roomProxy = await JoinedRoomProxyMock(.init(id: room.id, name: room.name))
|
||||
roomProxy.loadOrFetchEventForReturnValue = .success(TimelineEventSDKMock())
|
||||
return .joined(roomProxy)
|
||||
} else if let spaceRoomProxy = configuration.joinedSpaceRooms.first(where: { $0.id == identifier }) {
|
||||
await .joined(JoinedRoomProxyMock(.init(id: spaceRoomProxy.id, name: spaceRoomProxy.name)))
|
||||
let roomProxy = await JoinedRoomProxyMock(.init(id: spaceRoomProxy.id, name: spaceRoomProxy.name))
|
||||
roomProxy.loadOrFetchEventForReturnValue = .success(TimelineEventSDKMock())
|
||||
return .joined(roomProxy)
|
||||
} else {
|
||||
nil
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import Foundation
|
||||
extension TimelineControllerFactoryMock {
|
||||
struct Configuration {
|
||||
var timelineController: TimelineControllerProtocol?
|
||||
var threadTimelineController: TimelineControllerProtocol?
|
||||
}
|
||||
|
||||
convenience init(_ configuration: Configuration) {
|
||||
@@ -20,5 +21,15 @@ extension TimelineControllerFactoryMock {
|
||||
timelineController.timelineItems = RoomTimelineItemFixtures.largeChunk
|
||||
return timelineController
|
||||
}()
|
||||
|
||||
buildThreadTimelineControllerEventIDRoomProxyTimelineItemFactoryMediaProviderClosure = { threadRootEventID, _, _, _ in
|
||||
if let threadTimelineController = configuration.threadTimelineController {
|
||||
return .success(threadTimelineController)
|
||||
} else {
|
||||
let timelineController = MockTimelineController(timelineKind: .thread(rootEventID: threadRootEventID))
|
||||
timelineController.timelineItems = RoomTimelineItemFixtures.largeChunk
|
||||
return .success(timelineController)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user