mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-20 16:42:44 +02:00
Add sunset banners guiding users to install Element X when registering against a server with MAS. (#7890)
This commit is contained in:
+27
-3
@@ -24,7 +24,7 @@ class AuthenticationServerSelectionViewModelTests: XCTestCase {
|
||||
|
||||
@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.")
|
||||
XCTAssertNil(context.viewState.footerError, "There should not be an error message for a new view model.")
|
||||
XCTAssertFalse(context.viewState.isShowingFooterError, "There should not be an error shown.")
|
||||
|
||||
// When an error occurs.
|
||||
@@ -32,7 +32,7 @@ class AuthenticationServerSelectionViewModelTests: XCTestCase {
|
||||
viewModel.displayError(.footerMessage(message))
|
||||
|
||||
// Then the footer should now be showing an error.
|
||||
XCTAssertEqual(context.viewState.footerErrorMessage, message, "The error message should be stored.")
|
||||
XCTAssertEqual(context.viewState.footerError, .message(message), "The error message should be stored.")
|
||||
XCTAssertTrue(context.viewState.isShowingFooterError, "There should be an error shown.")
|
||||
|
||||
// And when clearing the error.
|
||||
@@ -42,7 +42,31 @@ class AuthenticationServerSelectionViewModelTests: XCTestCase {
|
||||
await Task.yield()
|
||||
|
||||
// Then the error message should now be removed.
|
||||
XCTAssertNil(context.viewState.footerErrorMessage, "The error message should have been cleared.")
|
||||
XCTAssertNil(context.viewState.footerError, "The error message should have been cleared.")
|
||||
XCTAssertFalse(context.viewState.isShowingFooterError, "There should not be an error shown anymore.")
|
||||
}
|
||||
|
||||
@MainActor func testSunsetBanner() async throws {
|
||||
// Given a new instance of the view model.
|
||||
XCTAssertNil(context.viewState.footerError, "There should not be an error for a new view model.")
|
||||
XCTAssertFalse(context.viewState.isShowingFooterError, "There should not be an error shown.")
|
||||
|
||||
// When an error occurs.
|
||||
let message = "Unable to contact server."
|
||||
viewModel.displayError(.requiresReplacementApp)
|
||||
|
||||
// Then the footer should now be showing an error.
|
||||
XCTAssertEqual(context.viewState.footerError, .sunsetBanner, "The banner should be shown.")
|
||||
XCTAssertTrue(context.viewState.isShowingFooterError, "There should be an error shown.")
|
||||
|
||||
// And when clearing the error.
|
||||
context.send(viewAction: .clearFooterError)
|
||||
|
||||
// Wait for the action to spawn a Task on the main actor as the Context protocol doesn't support actors.
|
||||
await Task.yield()
|
||||
|
||||
// Then the error message should now be removed.
|
||||
XCTAssertNil(context.viewState.footerError, "The error should have been cleared.")
|
||||
XCTAssertFalse(context.viewState.isShowingFooterError, "There should not be an error shown anymore.")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user