Loading app/src/test/java/foundation/e/apps/FakeAppLoungePreference.kt +18 −1 Original line number Diff line number Diff line Loading @@ -19,9 +19,20 @@ package foundation.e.apps import android.content.Context import foundation.e.apps.data.enums.User import foundation.e.apps.data.preference.AppLoungeDataStore import foundation.e.apps.data.preference.AppLoungePreference import io.mockk.every import io.mockk.mockk class FakeAppLoungePreference(context: Context) : AppLoungePreference(context) { class FakeAppLoungePreference(private val context: Context) : AppLoungePreference(context, createMockDataStore()) { companion object { private fun createMockDataStore(): AppLoungeDataStore { val mockDataStore = mockk<AppLoungeDataStore>(relaxed = true) every { mockDataStore.getUserType() } returns User.ANONYMOUS return mockDataStore } } var isPWASelectedFake = false var isOpenSourceelectedFake = false var isGplaySelectedFake = false Loading Loading @@ -50,4 +61,10 @@ class FakeAppLoungePreference(context: Context) : AppLoungePreference(context) { override fun shouldUpdateAppsFromOtherStores(): Boolean { return shouldUpdateFromOtherStores } override fun getUpdateInterval(): Long { val updateIntervals = context.resources.getStringArray(R.array.update_interval_values) return updateIntervals[1].toLong() // 168 (Weekly Interval) } } Loading
app/src/test/java/foundation/e/apps/FakeAppLoungePreference.kt +18 −1 Original line number Diff line number Diff line Loading @@ -19,9 +19,20 @@ package foundation.e.apps import android.content.Context import foundation.e.apps.data.enums.User import foundation.e.apps.data.preference.AppLoungeDataStore import foundation.e.apps.data.preference.AppLoungePreference import io.mockk.every import io.mockk.mockk class FakeAppLoungePreference(context: Context) : AppLoungePreference(context) { class FakeAppLoungePreference(private val context: Context) : AppLoungePreference(context, createMockDataStore()) { companion object { private fun createMockDataStore(): AppLoungeDataStore { val mockDataStore = mockk<AppLoungeDataStore>(relaxed = true) every { mockDataStore.getUserType() } returns User.ANONYMOUS return mockDataStore } } var isPWASelectedFake = false var isOpenSourceelectedFake = false var isGplaySelectedFake = false Loading Loading @@ -50,4 +61,10 @@ class FakeAppLoungePreference(context: Context) : AppLoungePreference(context) { override fun shouldUpdateAppsFromOtherStores(): Boolean { return shouldUpdateFromOtherStores } override fun getUpdateInterval(): Long { val updateIntervals = context.resources.getStringArray(R.array.update_interval_values) return updateIntervals[1].toLong() // 168 (Weekly Interval) } }