fix(healthchat): keep legacy accounts on the typed account provider

This commit is contained in:
Sedat Qaja
2026-10-19 09:18:08 +02:00
parent f7d0a05763
commit a80a6b8b0f
2 changed files with 18 additions and 1 deletions
@@ -15,7 +15,7 @@ import Foundation
/// - Legacy `element.io` help/encryption/copyright URLs are passed through unchanged for now.
struct HealthChatAppSettingsHook: AppSettingsHookProtocol {
func configure(_ appSettings: AppSettings) -> AppSettings {
appSettings.override(accountProviders: ["healthchat.ch"],
appSettings.override(accountProviders: [.generic("healthchat.ch")],
allowOtherAccountProviders: false,
hideBrandChrome: false,
pushGatewayBaseURL: "https://sygnal.healthchat.ch",
@@ -225,6 +225,23 @@ final class AuthenticationStartScreenViewModelTests {
#expect(account == classicAppAccount)
}
@Test
func healthChatProviderAllowsLegacyAccount() async {
// Given the account providers HealthChat ships with and an account from the legacy HealthChat app.
let classicAppAccount = makeClassicAppAccount(serverName: "healthchat.ch",
homeserverURL: "https://matrix.healthchat.ch")
appSettings = HealthChatAppSettingsHook().configure(appSettings)
await setupViewModel(classicAppAccount: classicAppAccount)
// Then the legacy account must still be offered for migration. A silent failure here logs every
// updating user out of the migration path, so the real hook values are tested, not a stand-in.
guard case .welcomeBack(let account) = context.viewState.classicAppMode else {
Issue.record("Expected classicAppMode to be .welcomeBack")
return
}
#expect(account == classicAppAccount)
}
@Test
func singleProviderWithDisallowedClassicAppAccount() async {
// Given a view model for an app that only allows a single provider that does NOT match the Classic account's server.