mirror of
https://github.com/d4rken-org/capod.git
synced 2026-09-15 02:36:12 -04:00
refactor: Move nudge persistence into GeneralSettings
Consolidate the nudge availability DataStoreValue with the rest of the persisted settings instead of carrying it in a separate Hilt module + DataStore file. Matches the existing convention where compat-style flags (offloaded filtering, indirect callbacks, etc.) live alongside theme/notification settings. NudgeCapabilityStore keeps the verdict-mapping behavior; only the source of the persisted value changes.
This commit is contained in:
committed by
Matthias Urhahn
parent
0e6848d886
commit
83ef111599
@@ -1,6 +1,9 @@
|
||||
package eu.darken.capod.common.bluetooth
|
||||
|
||||
import eu.darken.capod.main.core.GeneralSettings
|
||||
import io.kotest.matchers.shouldBe
|
||||
import io.mockk.every
|
||||
import io.mockk.mockk
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.test.UnconfinedTestDispatcher
|
||||
import kotlinx.coroutines.test.resetMain
|
||||
@@ -18,11 +21,15 @@ class NudgeCapabilityStoreTest : BaseTest() {
|
||||
private val testDispatcher = UnconfinedTestDispatcher()
|
||||
|
||||
private lateinit var fakePersisted: FakeDataStoreValue<NudgeAvailability>
|
||||
private lateinit var generalSettings: GeneralSettings
|
||||
|
||||
@BeforeEach
|
||||
fun setup() {
|
||||
Dispatchers.setMain(testDispatcher)
|
||||
fakePersisted = FakeDataStoreValue(NudgeAvailability.UNKNOWN)
|
||||
generalSettings = mockk<GeneralSettings>().also {
|
||||
every { it.nudgeAvailability } returns fakePersisted.mock
|
||||
}
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
@@ -31,7 +38,7 @@ class NudgeCapabilityStoreTest : BaseTest() {
|
||||
}
|
||||
|
||||
private fun createStore() = NudgeCapabilityStore(
|
||||
persistedValue = fakePersisted.mock,
|
||||
generalSettings = generalSettings,
|
||||
appScope = kotlinx.coroutines.CoroutineScope(testDispatcher),
|
||||
dispatcherProvider = TestDispatcherProvider(testDispatcher),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user