Improve detection of link device completion when linking a new device via QR (#5323)

* Improve detection of link device completion

* Fix tests to match
This commit is contained in:
Hugh Nimmo-Smith
2026-04-08 09:48:00 +01:00
committed by GitHub
parent 979ca55b0b
commit 5574dc8ab7
3 changed files with 12 additions and 11 deletions

View File

@@ -189,18 +189,17 @@ struct QRCodeLoginScreenViewModelTests {
linkMobileProgressSubject.send(.waitingForAuthorisation(verificationURL: .homeDirectory))
try await deferredAction.fulfill()
// Note: The SDK rarely sends the done action, so this test has been updated for the workaround of finishing early.
let currentState = context.viewState.state
let deferredFailure = deferFailure(context.$viewState, timeout: .seconds(1)) { $0.state != currentState }
linkMobileProgressSubject.send(.syncingSecrets)
try await deferredFailure.fulfill()
deferredAction = deferFulfillment(viewModel.actionsPublisher) { action in
guard case .linkedDevice = action else { return false }
return true
}
linkMobileProgressSubject.send(.syncingSecrets)
try await deferredAction.fulfill()
let currentState = context.viewState.state
let deferredFailure = deferFailure(context.$viewState, timeout: .seconds(1)) { $0.state != currentState }
linkMobileProgressSubject.send(.done)
try await deferredFailure.fulfill()
try await deferredAction.fulfill()
}
// MARK: - Helpers