mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
In preparation of FTUE changes... (#2556)
* Remove the welcome screen * Allow the UserSessionFlowCoordinator to control the whole app hierarchy, not only its splitView * Start using the new verification state listener * Rename Onboarding to AuthenticationStart in preparation for the new OnboardingFlowCoordinator; update snapshots and tests * Make the AuthenticationCoordinator a proper FlowCoordinator * Add some padding around the authentication start screen report a problem button * Bump the RustSDK to v1.1.49 * Only add bottom padding on the authentication start screen report a problem button
This commit is contained in:
@@ -17,62 +17,4 @@ import Combine
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
final class UserSessionTests: XCTestCase {
|
||||
var userSession: UserSession!
|
||||
var clientProxy: ClientProxyMock!
|
||||
let actionsPublisher = PassthroughSubject<ClientProxyAction, Never>()
|
||||
|
||||
private var cancellables = Set<AnyCancellable>()
|
||||
|
||||
override func setUpWithError() throws {
|
||||
clientProxy = ClientProxyMock(.init(userID: "@test:user.net"))
|
||||
clientProxy.actionsPublisher = actionsPublisher.eraseToAnyPublisher()
|
||||
|
||||
cancellables.removeAll()
|
||||
userSession = UserSession(clientProxy: clientProxy,
|
||||
mediaProvider: MockMediaProvider(),
|
||||
voiceMessageMediaManager: VoiceMessageMediaManagerMock())
|
||||
}
|
||||
|
||||
func test_whenUserSessionReceivesSyncUpdateAndSessionControllerRetrievedAndSessionNotVerified_sessionVerificationNeededEventReceived() throws {
|
||||
let expectation = expectation(description: "SessionVerificationNeeded expectation")
|
||||
userSession.sessionSecurityStatePublisher.sink { securityState in
|
||||
if securityState.verificationState == .unverified {
|
||||
expectation.fulfill()
|
||||
}
|
||||
}
|
||||
.store(in: &cancellables)
|
||||
|
||||
let controller = SessionVerificationControllerProxyMock.configureMock(callbacks: PassthroughSubject<SessionVerificationControllerProxyCallback, Never>(),
|
||||
isVerified: false,
|
||||
requestDelay: .zero)
|
||||
|
||||
clientProxy.sessionVerificationControllerProxyReturnValue = .success(controller)
|
||||
|
||||
actionsPublisher.send(.receivedSyncUpdate)
|
||||
|
||||
waitForExpectations(timeout: 1.0)
|
||||
}
|
||||
|
||||
func test_whenUserSessionReceivesSyncUpdateAndSessionIsVerified_didVerifySessionEventReceived() throws {
|
||||
let expectation = expectation(description: "DidVerifySessionEvent expectation")
|
||||
let controller = SessionVerificationControllerProxyMock.configureMock(callbacks: PassthroughSubject<SessionVerificationControllerProxyCallback, Never>(),
|
||||
isVerified: false,
|
||||
requestDelay: .zero)
|
||||
clientProxy.sessionVerificationControllerProxyReturnValue = .success(controller)
|
||||
|
||||
controller.callbacks.sink { value in
|
||||
switch value {
|
||||
case .finished:
|
||||
expectation.fulfill()
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
.store(in: &cancellables)
|
||||
|
||||
actionsPublisher.send(.receivedSyncUpdate)
|
||||
controller.callbacks.send(.finished)
|
||||
waitForExpectations(timeout: 1.0)
|
||||
}
|
||||
}
|
||||
final class UserSessionTests: XCTestCase { }
|
||||
|
||||
Reference in New Issue
Block a user