98b775d335
Adds a narrow IDataManager contract covering the 5 DataManager members referenced from ui/screens/** (currentUser, residences, totalSummary, featureBenefits, subscription) and a staticCompositionLocalOf ambient (LocalDataManager) that defaults to the DataManager singleton. No screen call-sites change in this commit — screens migrate in P0.2. ViewModels, APILayer, and PersistenceManager continue to depend on the concrete DataManager singleton directly; the interface is deliberately scoped to the screen surface the parity-gallery needs to substitute. Includes IDataManagerTest (DataManager is IDataManager) and LocalDataManagerTest (ambient val is exposed + default type-checks to the real singleton). runComposeUiTest intentionally avoided — consistent with ThemeSelectionScreenTest's convention, since commonTest composition runtime is flaky on iosSimulator. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
27 lines
1005 B
Kotlin
27 lines
1005 B
Kotlin
package com.tt.honeyDue.data
|
|
|
|
import kotlin.test.Test
|
|
import kotlin.test.assertTrue
|
|
|
|
/**
|
|
* Compile + runtime guard that the production [DataManager] singleton still
|
|
* satisfies the [IDataManager] contract. If a future refactor drops a member
|
|
* from the interface — or worse, drops the `: IDataManager` supertype from
|
|
* DataManager — this test fails loud, before any screen loses its data source.
|
|
*/
|
|
class IDataManagerTest {
|
|
|
|
// The `is IDataManager` check is statically `true` today — the compiler
|
|
// warning confirms DataManager satisfies the interface. If either side
|
|
// ever drifts, that status changes (or the file fails to compile), so
|
|
// this test acts as a compile-time + runtime guard.
|
|
@Suppress("USELESS_IS_CHECK")
|
|
@Test
|
|
fun dataManagerSingletonImplementsIDataManager() {
|
|
assertTrue(
|
|
DataManager is IDataManager,
|
|
"DataManager must implement IDataManager so screens can resolve it through LocalDataManager."
|
|
)
|
|
}
|
|
}
|