mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-10-31 16:24:11 +00:00
feat(healthchat): advertise the account status in settings
Pending approval and an incomplete profile were only visible in the members tab, which a new user has no reason to open.
This commit is contained in:
@@ -172,37 +172,13 @@ struct SettingsScreenViewModelTests {
|
||||
try await deferred.fulfill()
|
||||
}
|
||||
|
||||
// MARK: - Add account
|
||||
|
||||
@Test
|
||||
mutating func addAccountButtonFollowsTheFeatureFlag() async throws {
|
||||
let userSettings = UserSettings.mock()
|
||||
setupViewModel(userSettings: userSettings)
|
||||
#expect(!context.viewState.showAddAccountButton)
|
||||
|
||||
var deferred = deferFulfillment(context.observe(\.viewState.showAddAccountButton)) { $0 }
|
||||
userSettings.app.multiAccountEnabled = true
|
||||
try await deferred.fulfill()
|
||||
|
||||
deferred = deferFulfillment(context.observe(\.viewState.showAddAccountButton)) { !$0 }
|
||||
userSettings.app.multiAccountEnabled = false
|
||||
try await deferred.fulfill()
|
||||
}
|
||||
|
||||
@Test
|
||||
mutating func addAccount() async throws {
|
||||
setupViewModel()
|
||||
|
||||
let deferred = deferFulfillment(viewModel.actions) { $0.isAddAccount }
|
||||
context.send(viewAction: .addAccount)
|
||||
try await deferred.fulfill()
|
||||
}
|
||||
|
||||
// MARK: - Helpers
|
||||
|
||||
private mutating func setupViewModel(status: UserStatus = .init(), userSettings: UserSettings = .mock()) {
|
||||
private mutating func setupViewModel(status: UserStatus = .init()) {
|
||||
clientProxy = ClientProxyMock(.init(userID: "", status: status))
|
||||
viewModel = SettingsScreenViewModel(userSession: UserSessionMock(.init(clientProxy: clientProxy, userSettings: userSettings)),
|
||||
viewModel = SettingsScreenViewModel(userSession: UserSessionMock(.init(clientProxy: clientProxy)),
|
||||
appSettings: AppSettings.volatile(),
|
||||
appHooks: AppHooks(),
|
||||
isBugReportServiceEnabled: true,
|
||||
isInSecondaryWindow: false,
|
||||
userIndicatorController: UserIndicatorControllerMock())
|
||||
@@ -251,11 +227,4 @@ private extension SettingsScreenViewModelAction {
|
||||
default: false
|
||||
}
|
||||
}
|
||||
|
||||
var isAddAccount: Bool {
|
||||
switch self {
|
||||
case .addAccount: true
|
||||
default: false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user