Optimize invites list (part 2) (#1268)
* Optimise invites list * Fix failing tests * Cleanup * Add weak self * Refactor ReportContentViewModelTests
This commit is contained in:
@@ -96,6 +96,7 @@ class HomeScreenViewModelTests: XCTestCase {
|
||||
func testLeaveRoomSuccess() async throws {
|
||||
let mockRoomId = "1"
|
||||
var correctResult = false
|
||||
let expectation = expectation(description: #function)
|
||||
viewModel.callback = { result in
|
||||
switch result {
|
||||
case .roomLeft(let roomIdentifier):
|
||||
@@ -103,12 +104,13 @@ class HomeScreenViewModelTests: XCTestCase {
|
||||
default:
|
||||
break
|
||||
}
|
||||
expectation.fulfill()
|
||||
}
|
||||
let room: RoomProxyMock = .init(with: .init(id: mockRoomId, displayName: "Some room"))
|
||||
room.leaveRoomClosure = { .success(()) }
|
||||
clientProxy.roomForIdentifierMocks[mockRoomId] = room
|
||||
context.send(viewAction: .confirmLeaveRoom(roomIdentifier: mockRoomId))
|
||||
await Task.yield()
|
||||
await fulfillment(of: [expectation])
|
||||
XCTAssertNil(context.alertInfo)
|
||||
XCTAssertTrue(correctResult)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user