Refine UTs

This commit is contained in:
Alfonso Grillo
2022-12-13 15:45:37 +01:00
parent 4201c0060e
commit da14628802
2 changed files with 14 additions and 12 deletions
@@ -77,6 +77,15 @@ class UserSessionsDataProvider: UserSessionsDataProviderProtocol {
}
extension UserSessionsDataProvider {
private func deleteAccountDataIfNeeded(deviceList: [MXDevice]) {
let obsoletedDeviceAccountDataKeys = obsoletedDeviceAccountData(deviceList: deviceList,
accountDataEvents: session.accountData.allAccountDataEvents())
for accountDataKey in obsoletedDeviceAccountDataKeys {
session.deleteAccountData(withType: accountDataKey, success: {}, failure: { _ in })
}
}
// internal just to facilitate tests
func obsoletedDeviceAccountData(deviceList: [MXDevice], accountDataEvents: [String: Any]) -> Set<String> {
let deviceAccountDataKeys = Set(
@@ -91,13 +100,4 @@ extension UserSessionsDataProvider {
return deviceAccountDataKeys.subtracting(expectedDeviceAccountDataKeys)
}
private func deleteAccountDataIfNeeded(deviceList: [MXDevice]) {
let obsoletedDeviceAccountDataKeys = obsoletedDeviceAccountData(deviceList: deviceList,
accountDataEvents: session.accountData.allAccountDataEvents())
for accountDataKey in obsoletedDeviceAccountDataKeys {
session.deleteAccountData(withType: accountDataKey, success: {}, failure: { _ in })
}
}
}