Introduce a new RoomProxyType and treat rooms differently based on their membership state

This commit is contained in:
Stefan Ceriu
2024-08-20 16:13:27 +03:00
committed by Stefan Ceriu
parent e0ba9925e7
commit e281a3f242
97 changed files with 3755 additions and 3474 deletions
@@ -87,7 +87,7 @@ class HomeScreenViewModelTests: XCTestCase {
func testLeaveRoomAlert() async throws {
let mockRoomId = "1"
clientProxy.roomForIdentifierClosure = { _ in RoomProxyMock(.init(id: mockRoomId, name: "Some room")) }
clientProxy.roomForIdentifierClosure = { _ in .joined(JoinedRoomProxyMock(.init(id: mockRoomId, name: "Some room"))) }
let deferred = deferFulfillment(context.$viewState) { value in
value.bindings.leaveRoomAlertItem != nil
@@ -102,10 +102,10 @@ class HomeScreenViewModelTests: XCTestCase {
func testLeaveRoomError() async throws {
let mockRoomId = "1"
let room = RoomProxyMock(.init(id: mockRoomId, name: "Some room"))
let room = JoinedRoomProxyMock(.init(id: mockRoomId, name: "Some room"))
room.leaveRoomClosure = { .failure(.sdkError(ClientProxyMockError.generic)) }
clientProxy.roomForIdentifierClosure = { _ in room }
clientProxy.roomForIdentifierClosure = { _ in .joined(room) }
let deferred = deferFulfillment(context.$viewState) { value in
value.bindings.alertInfo != nil
@@ -133,10 +133,10 @@ class HomeScreenViewModelTests: XCTestCase {
expectation.fulfill()
}
.store(in: &cancellables)
let room = RoomProxyMock(.init(id: mockRoomId, name: "Some room"))
let room = JoinedRoomProxyMock(.init(id: mockRoomId, name: "Some room"))
room.leaveRoomClosure = { .success(()) }
clientProxy.roomForIdentifierClosure = { _ in room }
clientProxy.roomForIdentifierClosure = { _ in .joined(room) }
context.send(viewAction: .confirmLeaveRoom(roomIdentifier: mockRoomId))
await fulfillment(of: [expectation])