Disable the next button whilst loading a server.

Add tests for login screen.
Self review.
This commit is contained in:
Doug
2022-05-24 14:03:39 +01:00
parent e77d7d9250
commit 292cd4a5d2
20 changed files with 309 additions and 64 deletions
@@ -31,7 +31,7 @@ class AuthenticationServerSelectionViewModelTests: XCTestCase {
context = viewModel.context
}
@MainActor func testErrorMessage() async {
@MainActor func testErrorMessage() async throws {
// Given a new instance of the view model.
XCTAssertNil(context.viewState.footerErrorMessage, "There should not be an error message for a new view model.")
XCTAssertEqual(context.viewState.footerMessage, VectorL10n.authenticationServerSelectionServerFooter, "The standard footer message should be shown.")
@@ -48,8 +48,7 @@ class AuthenticationServerSelectionViewModelTests: XCTestCase {
context.send(viewAction: .clearFooterError)
// Wait for the action to spawn a Task on the main actor as the Context protocol doesn't support actors.
let task = Task { try await Task.sleep(nanoseconds: 100_000_000) }
_ = await task.result
try await Task.sleep(nanoseconds: 100_000_000)
// Then the error message should now be removed.
XCTAssertNil(context.viewState.footerErrorMessage, "The error message should have been cleared.")