Files
Termind/TFITests/MobileMultiConnectionAccessTests.swift
T
Kaede Akino 3708a7c54f refactor: remove obsolete code and redundant tests
Remove legacy Commerce types, unused helpers, duplicate SFTP progress code, and 28 unreferenced strings. Drop fixture-only tests and arbitrary screenshot size assertions while retaining behavioral coverage.

Validation: 2,592 macOS tests, 40 focused macOS tests, and 53 iOS tests passed. Swift formatting, AppStrings, and Chinese localization checks passed.
2026-10-02 17:50:47 +08:00

38 lines
1.5 KiB
Swift

import TermindDomain
import Testing
@testable import TermindIOS
@testable import TermindInfrastructure
@Suite @MainActor
struct MobileMultiConnectionAccessTests {
@Test(arguments: SFTPConcurrencyStrategy.allCases)
func entitlementChangesPreserveSavedSettingsWithoutAnyScene(_ strategy: SFTPConcurrencyStrategy) async throws {
let service = MobileConnectionPurchaseService()
let pro = ProAccessController(purchaseService: service, observeUpdates: false)
var dependencies = MobileAppDependencies.testing()
dependencies.proAccess = pro
let app = try MobileAppModel(dependencies: dependencies)
app.sftpSettings.setStrategy(strategy)
#expect(app.transfers.strategy == .channelsOnly)
service.status = .purchased(.purchased)
await pro.refresh()
#expect(app.transfers.strategy == strategy)
service.status = .free
await pro.refresh()
#expect(app.transfers.strategy == .channelsOnly)
#expect(app.sftpSettings.preferences.strategy == strategy)
app.sftpSettings.set(60, for: \.globalLimit)
#expect(app.transfers.globalLimit == 60)
#expect(app.transfers.strategy == .channelsOnly)
#expect(!pro.isPaywallPresented)
}
}
@MainActor
private final class MobileConnectionPurchaseService: ProPurchaseService {
let updates = AsyncStream<EntitlementStatus> { $0.finish() }
var status = EntitlementStatus.free
func currentStatus() async throws -> EntitlementStatus { status }
}