Loading app/src/test/java/foundation/e/apps/FakeAppLoungePreference.kt +5 −11 Original line number Diff line number Diff line Loading @@ -19,20 +19,14 @@ 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(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 } } class FakeAppLoungePreference( private val context: Context, appLoungeDataStore: AppLoungeDataStore, ) : AppLoungePreference(context, appLoungeDataStore) { var isPWASelectedFake = false var isOpenSourceelectedFake = false var isGplaySelectedFake = false Loading app/src/test/java/foundation/e/apps/UpdateManagerImptTest.kt +8 −5 Original line number Diff line number Diff line Loading @@ -20,17 +20,17 @@ package foundation.e.apps import android.content.Context import androidx.arch.core.executor.testing.InstantTaskExecutorRule import com.aurora.gplayapi.data.models.AuthData import foundation.e.apps.data.application.ApplicationRepository import foundation.e.apps.data.application.data.Application import foundation.e.apps.data.blockedApps.BlockedAppRepository import foundation.e.apps.data.enums.FilterLevel import foundation.e.apps.data.enums.ResultStatus import foundation.e.apps.data.enums.Source import foundation.e.apps.data.enums.Status import foundation.e.apps.data.faultyApps.FaultyAppRepository import foundation.e.apps.data.fdroid.FDroidRepository import foundation.e.apps.data.application.ApplicationRepository import foundation.e.apps.data.application.search.SearchRepository import foundation.e.apps.data.application.data.Application import foundation.e.apps.data.enums.Source import foundation.e.apps.data.gitlab.SystemAppsUpdatesRepository import foundation.e.apps.data.preference.AppLoungeDataStore import foundation.e.apps.data.updates.UpdatesManagerImpl import foundation.e.apps.util.MainCoroutineRule import kotlinx.coroutines.ExperimentalCoroutinesApi Loading Loading @@ -82,13 +82,16 @@ class UpdateManagerImptTest { @Mock private lateinit var systemAppsUpdatesRepository: SystemAppsUpdatesRepository @Mock private lateinit var appLoungeDataStore: AppLoungeDataStore val authData = AuthData("e@e.email", "AtadyMsIAtadyM") @Before fun setup() { MockitoAnnotations.openMocks(this) faultyAppRepository = FaultyAppRepository(FakeFaultyAppDao()) preferenceModule = FakeAppLoungePreference(context) preferenceModule = FakeAppLoungePreference(context, appLoungeDataStore) pkgManagerModule = FakeAppLoungePackageManager(context, getGplayApps()) updatesManagerImpl = UpdatesManagerImpl( context, Loading app/src/test/java/foundation/e/apps/fused/SearchRepositoryImplTest.kt +5 −1 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ import foundation.e.apps.data.cleanapk.repositories.CleanApkPwaRepository import foundation.e.apps.data.enums.Source import foundation.e.apps.data.enums.Status import foundation.e.apps.data.playstore.PlayStoreRepository import foundation.e.apps.data.preference.AppLoungeDataStore import foundation.e.apps.install.pkg.AppLoungePackageManager import foundation.e.apps.install.pkg.PwaManager import foundation.e.apps.util.MainCoroutineRule Loading Loading @@ -95,6 +96,9 @@ class SearchRepositoryImplTest { @Mock private lateinit var visibilityFetcher: AppVisibilityResolver @Mock private lateinit var appLoungeDataStore: AppLoungeDataStore private lateinit var appsApi: AppsApi private lateinit var applicationDataManager: ApplicationDataManager Loading @@ -107,7 +111,7 @@ class SearchRepositoryImplTest { fun setup() { MockitoAnnotations.openMocks(this) formatterMocked = Mockito.mockStatic(Formatter::class.java) preferenceManagerModule = FakeAppLoungePreference(context) preferenceManagerModule = FakeAppLoungePreference(context, appLoungeDataStore) applicationDataManager = ApplicationDataManager(appLoungePackageManager, pwaManager, visibilityFetcher) val appSourcesContainer = Loading Loading
app/src/test/java/foundation/e/apps/FakeAppLoungePreference.kt +5 −11 Original line number Diff line number Diff line Loading @@ -19,20 +19,14 @@ 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(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 } } class FakeAppLoungePreference( private val context: Context, appLoungeDataStore: AppLoungeDataStore, ) : AppLoungePreference(context, appLoungeDataStore) { var isPWASelectedFake = false var isOpenSourceelectedFake = false var isGplaySelectedFake = false Loading
app/src/test/java/foundation/e/apps/UpdateManagerImptTest.kt +8 −5 Original line number Diff line number Diff line Loading @@ -20,17 +20,17 @@ package foundation.e.apps import android.content.Context import androidx.arch.core.executor.testing.InstantTaskExecutorRule import com.aurora.gplayapi.data.models.AuthData import foundation.e.apps.data.application.ApplicationRepository import foundation.e.apps.data.application.data.Application import foundation.e.apps.data.blockedApps.BlockedAppRepository import foundation.e.apps.data.enums.FilterLevel import foundation.e.apps.data.enums.ResultStatus import foundation.e.apps.data.enums.Source import foundation.e.apps.data.enums.Status import foundation.e.apps.data.faultyApps.FaultyAppRepository import foundation.e.apps.data.fdroid.FDroidRepository import foundation.e.apps.data.application.ApplicationRepository import foundation.e.apps.data.application.search.SearchRepository import foundation.e.apps.data.application.data.Application import foundation.e.apps.data.enums.Source import foundation.e.apps.data.gitlab.SystemAppsUpdatesRepository import foundation.e.apps.data.preference.AppLoungeDataStore import foundation.e.apps.data.updates.UpdatesManagerImpl import foundation.e.apps.util.MainCoroutineRule import kotlinx.coroutines.ExperimentalCoroutinesApi Loading Loading @@ -82,13 +82,16 @@ class UpdateManagerImptTest { @Mock private lateinit var systemAppsUpdatesRepository: SystemAppsUpdatesRepository @Mock private lateinit var appLoungeDataStore: AppLoungeDataStore val authData = AuthData("e@e.email", "AtadyMsIAtadyM") @Before fun setup() { MockitoAnnotations.openMocks(this) faultyAppRepository = FaultyAppRepository(FakeFaultyAppDao()) preferenceModule = FakeAppLoungePreference(context) preferenceModule = FakeAppLoungePreference(context, appLoungeDataStore) pkgManagerModule = FakeAppLoungePackageManager(context, getGplayApps()) updatesManagerImpl = UpdatesManagerImpl( context, Loading
app/src/test/java/foundation/e/apps/fused/SearchRepositoryImplTest.kt +5 −1 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ import foundation.e.apps.data.cleanapk.repositories.CleanApkPwaRepository import foundation.e.apps.data.enums.Source import foundation.e.apps.data.enums.Status import foundation.e.apps.data.playstore.PlayStoreRepository import foundation.e.apps.data.preference.AppLoungeDataStore import foundation.e.apps.install.pkg.AppLoungePackageManager import foundation.e.apps.install.pkg.PwaManager import foundation.e.apps.util.MainCoroutineRule Loading Loading @@ -95,6 +96,9 @@ class SearchRepositoryImplTest { @Mock private lateinit var visibilityFetcher: AppVisibilityResolver @Mock private lateinit var appLoungeDataStore: AppLoungeDataStore private lateinit var appsApi: AppsApi private lateinit var applicationDataManager: ApplicationDataManager Loading @@ -107,7 +111,7 @@ class SearchRepositoryImplTest { fun setup() { MockitoAnnotations.openMocks(this) formatterMocked = Mockito.mockStatic(Formatter::class.java) preferenceManagerModule = FakeAppLoungePreference(context) preferenceManagerModule = FakeAppLoungePreference(context, appLoungeDataStore) applicationDataManager = ApplicationDataManager(appLoungePackageManager, pwaManager, visibilityFetcher) val appSourcesContainer = Loading