Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a6f266b0 authored by Saalim Quadri's avatar Saalim Quadri Committed by Nishith Khanna
Browse files

test: Pass appLoungeDataStore param

parent 24ff1c56
Loading
Loading
Loading
Loading
Loading
+18 −1
Original line number Diff line number Diff line
@@ -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
@@ -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)
    }
}