mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Invite people in an existing room (#915)
* Handle power levels * Add “invite” button in RoomMembersListScreen * Refactor DI in RoomDetailsScreenCoordinator * Add navigation to “select people” coordinator * Add InviteUsersScreenRoomContext * Add invite user by id api * Updare InviteUsersScreenRoomContext * Support disabled state on FormButtonStyles * Handle membership in UserProfileCell * Fix conflicts * Refactor RoomContext -> RoomType * Refactor UserProfileCell * Add invite action * Setup navigation to user flow coordinator * Add invite logic * Fix test build errors * Address comments * Fix localisations * Update required state * Handle error * Move invite logic in RoomDetailsScreenCoordinator * Add navigation from room’s members list * Fix UTs * Fix missing display name in RoomMemberDetails * Add user indicator * Add feature flag * Add RoomDetailsViewModel UTs * Add room details ui tests * Add InviteUsersViewModelTests UTs * Add UI tests * Update UI tests * Empty commit
This commit is contained in:
@@ -180,4 +180,38 @@ class RoomDetailsScreenViewModelTests: XCTestCase {
|
||||
XCTAssert(context.viewState.dmRecipient?.isIgnored == true)
|
||||
XCTAssertNotNil(context.alertInfo)
|
||||
}
|
||||
|
||||
func testCannotInvitePeople() async {
|
||||
let mockedMembers: [RoomMemberProxyMock] = [.mockBob, .mockAlice]
|
||||
roomProxyMock = RoomProxyMock(with: .init(displayName: "Test", isPublic: true, members: mockedMembers))
|
||||
viewModel = RoomDetailsScreenViewModel(roomProxy: roomProxyMock, mediaProvider: MockMediaProvider())
|
||||
|
||||
await context.nextViewState()
|
||||
|
||||
XCTAssertFalse(context.viewState.canInviteUsers)
|
||||
}
|
||||
|
||||
func testInvitePeople() async {
|
||||
let mockedMembers: [RoomMemberProxyMock] = [.mockMe, .mockBob, .mockAlice]
|
||||
roomProxyMock = RoomProxyMock(with: .init(displayName: "Test", isPublic: true, members: mockedMembers))
|
||||
viewModel = RoomDetailsScreenViewModel(roomProxy: roomProxyMock, mediaProvider: MockMediaProvider())
|
||||
|
||||
await context.nextViewState()
|
||||
|
||||
XCTAssertTrue(context.viewState.canInviteUsers)
|
||||
|
||||
var callbackCorrectlyCalled = false
|
||||
viewModel.callback = { action in
|
||||
switch action {
|
||||
case .requestInvitePeoplePresentation(let members):
|
||||
callbackCorrectlyCalled = members.map(\.userID) == mockedMembers.map(\.userID)
|
||||
default:
|
||||
callbackCorrectlyCalled = false
|
||||
}
|
||||
}
|
||||
|
||||
context.send(viewAction: .processTapInvite)
|
||||
await Task.yield()
|
||||
XCTAssertTrue(callbackCorrectlyCalled)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user