mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Renaming screens returns (#829)
* Rename: StartChat -> StartChatScreen * Rename: Login -> LoginScreen * Rename: ServerSelection -> ServerSelectionScreen * Rename: SoftLogout -> SoftLogoutScreen
This commit is contained in:
@@ -21,11 +21,11 @@ import XCTest
|
||||
@MainActor
|
||||
class LoginViewModelTests: XCTestCase {
|
||||
let defaultHomeserver = LoginHomeserver.mockMatrixDotOrg
|
||||
var viewModel: LoginViewModelProtocol!
|
||||
var context: LoginViewModelType.Context!
|
||||
var viewModel: LoginScreenViewModelProtocol!
|
||||
var context: LoginScreenViewModelType.Context!
|
||||
|
||||
@MainActor override func setUp() async throws {
|
||||
viewModel = LoginViewModel(homeserver: defaultHomeserver)
|
||||
viewModel = LoginScreenViewModel(homeserver: defaultHomeserver)
|
||||
context = viewModel.context
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ class LoginViewModelTests: XCTestCase {
|
||||
func testLogsForPassword() {
|
||||
// Given the coordinator and view model results that contain passwords.
|
||||
let password = "supersecretpassword"
|
||||
let viewModelAction: LoginViewModelAction = .login(username: "Alice", password: password)
|
||||
let viewModelAction: LoginScreenViewModelAction = .login(username: "Alice", password: password)
|
||||
|
||||
// When creating a string representation of those results (e.g. for logging).
|
||||
let viewModelActionString = "\(viewModelAction)"
|
||||
|
||||
@@ -24,11 +24,11 @@ class ServerSelectionViewModelTests: XCTestCase {
|
||||
static let counterInitialValue = 0
|
||||
}
|
||||
|
||||
var viewModel: ServerSelectionViewModelProtocol!
|
||||
var context: ServerSelectionViewModelType.Context!
|
||||
var viewModel: ServerSelectionScreenViewModelProtocol!
|
||||
var context: ServerSelectionScreenViewModelType.Context!
|
||||
|
||||
@MainActor override func setUp() {
|
||||
viewModel = ServerSelectionViewModel(homeserverAddress: "", isModallyPresented: true)
|
||||
viewModel = ServerSelectionScreenViewModel(homeserverAddress: "", isModallyPresented: true)
|
||||
context = viewModel.context
|
||||
}
|
||||
|
||||
|
||||
@@ -19,17 +19,17 @@ import XCTest
|
||||
@testable import ElementX
|
||||
|
||||
class SoftLogoutViewModelTests: XCTestCase {
|
||||
let credentials = SoftLogoutCredentials(userId: "mock_user_id",
|
||||
homeserverName: "https://matrix.org",
|
||||
userDisplayName: "mock_username",
|
||||
deviceId: "ABCDEFGH")
|
||||
|
||||
let credentials = SoftLogoutScreenCredentials(userId: "mock_user_id",
|
||||
homeserverName: "https://matrix.org",
|
||||
userDisplayName: "mock_username",
|
||||
deviceId: "ABCDEFGH")
|
||||
|
||||
@MainActor func testInitialStateForMatrixOrg() {
|
||||
let viewModel = SoftLogoutViewModel(credentials: credentials,
|
||||
homeserver: .mockMatrixDotOrg,
|
||||
keyBackupNeeded: true)
|
||||
let viewModel = SoftLogoutScreenViewModel(credentials: credentials,
|
||||
homeserver: .mockMatrixDotOrg,
|
||||
keyBackupNeeded: true)
|
||||
let context = viewModel.context
|
||||
|
||||
|
||||
// Given a view model where the user hasn't yet sent the verification email.
|
||||
XCTAssert(context.password.isEmpty, "The view model should start with an empty password.")
|
||||
XCTAssertFalse(context.viewState.canSubmit, "The view model should start with an invalid password.")
|
||||
@@ -38,10 +38,10 @@ class SoftLogoutViewModelTests: XCTestCase {
|
||||
}
|
||||
|
||||
@MainActor func testInitialStateForMatrixOrgPasswordEntered() {
|
||||
let viewModel = SoftLogoutViewModel(credentials: credentials,
|
||||
homeserver: .mockMatrixDotOrg,
|
||||
keyBackupNeeded: true,
|
||||
password: "12345678")
|
||||
let viewModel = SoftLogoutScreenViewModel(credentials: credentials,
|
||||
homeserver: .mockMatrixDotOrg,
|
||||
keyBackupNeeded: true,
|
||||
password: "12345678")
|
||||
let context = viewModel.context
|
||||
|
||||
// Given a view model where the user hasn't yet sent the verification email.
|
||||
@@ -49,13 +49,13 @@ class SoftLogoutViewModelTests: XCTestCase {
|
||||
XCTAssertEqual(context.viewState.loginMode, .password, "The view model should show login form for the given homeserver.")
|
||||
XCTAssert(context.viewState.showRecoverEncryptionKeysMessage, "The view model should show recover encryption keys message.")
|
||||
}
|
||||
|
||||
|
||||
@MainActor func testInitialStateForBasicServer() {
|
||||
let viewModel = SoftLogoutViewModel(credentials: credentials,
|
||||
homeserver: .mockBasicServer,
|
||||
keyBackupNeeded: false)
|
||||
let viewModel = SoftLogoutScreenViewModel(credentials: credentials,
|
||||
homeserver: .mockBasicServer,
|
||||
keyBackupNeeded: false)
|
||||
let context = viewModel.context
|
||||
|
||||
|
||||
// Given a view model where the user hasn't yet sent the verification email.
|
||||
XCTAssert(context.password.isEmpty, "The view model should start with an empty password.")
|
||||
XCTAssertFalse(context.viewState.canSubmit, "The view model should start with an invalid password.")
|
||||
@@ -64,22 +64,22 @@ class SoftLogoutViewModelTests: XCTestCase {
|
||||
}
|
||||
|
||||
@MainActor func testInitialStateForOIDC() {
|
||||
let viewModel = SoftLogoutViewModel(credentials: credentials,
|
||||
homeserver: .mockOIDC,
|
||||
keyBackupNeeded: false)
|
||||
let viewModel = SoftLogoutScreenViewModel(credentials: credentials,
|
||||
homeserver: .mockOIDC,
|
||||
keyBackupNeeded: false)
|
||||
let context = viewModel.context
|
||||
|
||||
|
||||
// Given a view model where the user hasn't yet sent the verification email.
|
||||
XCTAssert(context.password.isEmpty, "The view model should start with an empty password.")
|
||||
XCTAssertFalse(context.viewState.canSubmit, "The view model should start with an invalid password.")
|
||||
XCTAssertTrue(context.viewState.loginMode.supportsOIDCFlow, "The view model should show OIDC button for the given homeserver.")
|
||||
XCTAssertFalse(context.viewState.showRecoverEncryptionKeysMessage, "The view model should not show recover encryption keys message.")
|
||||
}
|
||||
|
||||
|
||||
@MainActor func testInitialStateForUnsupported() {
|
||||
let viewModel = SoftLogoutViewModel(credentials: credentials,
|
||||
homeserver: .mockUnsupported,
|
||||
keyBackupNeeded: false)
|
||||
let viewModel = SoftLogoutScreenViewModel(credentials: credentials,
|
||||
homeserver: .mockUnsupported,
|
||||
keyBackupNeeded: false)
|
||||
let context = viewModel.context
|
||||
|
||||
// Given a view model where the user hasn't yet sent the verification email.
|
||||
|
||||
@@ -20,11 +20,11 @@ import XCTest
|
||||
|
||||
@MainActor
|
||||
class StartChatScreenViewModelTests: XCTestCase {
|
||||
var viewModel: StartChatViewModelProtocol!
|
||||
var viewModel: StartChatScreenViewModelProtocol!
|
||||
var clientProxy: MockClientProxy!
|
||||
var userDiscoveryService: UserDiscoveryServiceMock!
|
||||
|
||||
var context: StartChatViewModel.Context {
|
||||
var context: StartChatScreenViewModel.Context {
|
||||
viewModel.context
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ class StartChatScreenViewModelTests: XCTestCase {
|
||||
userDiscoveryService.fetchSuggestionsReturnValue = .success([])
|
||||
userDiscoveryService.searchProfilesWithReturnValue = .success([])
|
||||
let userSession = MockUserSession(clientProxy: clientProxy, mediaProvider: MockMediaProvider())
|
||||
viewModel = StartChatViewModel(userSession: userSession, userIndicatorController: nil, userDiscoveryService: userDiscoveryService)
|
||||
viewModel = StartChatScreenViewModel(userSession: userSession, userIndicatorController: nil, userDiscoveryService: userDiscoveryService)
|
||||
|
||||
setupAppSettings()
|
||||
ServiceLocator.shared.settings.startChatUserSuggestionsEnabled = true
|
||||
@@ -65,7 +65,7 @@ class StartChatScreenViewModelTests: XCTestCase {
|
||||
}
|
||||
|
||||
@discardableResult
|
||||
private func search(query: String) async -> StartChatViewState? {
|
||||
private func search(query: String) async -> StartChatScreenViewState? {
|
||||
viewModel.context.searchQuery = query
|
||||
return await context.$viewState.nextValue
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user