From 61384f9986e4757c98dba1d4ad0f14647a78590b Mon Sep 17 00:00:00 2001 From: Mauro Romito Date: Wed, 30 Sep 2026 15:18:30 +0200 Subject: [PATCH] Use the window scene initialiser for UIWindow in tests UIWindow.init() is deprecated in iOS 26. AuthenticationStartScreenViewModelTests now creates its fake window from the test host's connected scene, matching ServerSelectionScreenViewModelTests. --- .../Sources/AuthenticationStartScreenViewModelTests.swift | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/UnitTests/Sources/AuthenticationStartScreenViewModelTests.swift b/UnitTests/Sources/AuthenticationStartScreenViewModelTests.swift index 7d1a41909..ebbf9cfa0 100644 --- a/UnitTests/Sources/AuthenticationStartScreenViewModelTests.swift +++ b/UnitTests/Sources/AuthenticationStartScreenViewModelTests.swift @@ -315,7 +315,11 @@ final class AuthenticationStartScreenViewModelTests { userIndicatorController: UserIndicatorControllerMock()) // Add a fake window in order for the OAuth flow to continue - viewModel.context.send(viewAction: .updateWindow(UIWindow())) + guard let scene = UIApplication.shared.connectedScenes.first as? UIWindowScene else { + Issue.record("The test host is missing a window scene.") + return + } + viewModel.context.send(viewAction: .updateWindow(UIWindow(windowScene: scene))) } private func makeClassicAppAccount(serverName: String = "company.com",