diff options
-rw-r--r-- | app/build.gradle.kts | 3 | ||||
-rw-r--r-- | app/src/test/java/dev/msfjarvis/aps/util/settings/MigrationsTest.kt (renamed from app/src/androidTest/java/dev/msfjarvis/aps/util/settings/MigrationsTest.kt) | 13 |
2 files changed, 10 insertions, 6 deletions
diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 4b420846..c12cf566 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -47,6 +47,9 @@ android { create("free") {} create("nonFree") {} } + testOptions { + unitTests.isReturnDefaultValues = true + } } dependencies { diff --git a/app/src/androidTest/java/dev/msfjarvis/aps/util/settings/MigrationsTest.kt b/app/src/test/java/dev/msfjarvis/aps/util/settings/MigrationsTest.kt index a5975be7..d6c9e6b6 100644 --- a/app/src/androidTest/java/dev/msfjarvis/aps/util/settings/MigrationsTest.kt +++ b/app/src/test/java/dev/msfjarvis/aps/util/settings/MigrationsTest.kt @@ -9,6 +9,7 @@ package dev.msfjarvis.aps.util.settings import android.content.Context import androidx.core.content.edit +import com.github.ivanshafran.sharedpreferencesmock.SPMockBuilder import dev.msfjarvis.aps.Application import dev.msfjarvis.aps.util.extensions.getString import dev.msfjarvis.aps.util.extensions.sharedPrefs @@ -30,7 +31,7 @@ class MigrationsTest { @Test fun verifySshWithCustomPortMigration() { - val context = Application.instance.applicationContext + val context = SPMockBuilder().createContext() context.sharedPrefs.edit { clear() putString(PreferenceKeys.GIT_REMOTE_PORT, "2200") @@ -50,7 +51,7 @@ class MigrationsTest { @Test fun verifySshWithDefaultPortMigration() { - val context = Application.instance.applicationContext + val context = SPMockBuilder().createContext() context.sharedPrefs.edit { clear() putString(PreferenceKeys.GIT_REMOTE_USERNAME, "msfjarvis") @@ -69,7 +70,7 @@ class MigrationsTest { @Test fun verifyHttpsWithGitHubMigration() { - val context = Application.instance.applicationContext + val context = SPMockBuilder().createContext() context.sharedPrefs.edit { clear() putString(PreferenceKeys.GIT_REMOTE_USERNAME, "msfjarvis") @@ -88,7 +89,7 @@ class MigrationsTest { @Test fun verifyHiddenFoldersMigrationIfDisabled() { - val context = Application.instance.applicationContext + val context = SPMockBuilder().createContext() context.sharedPrefs.edit { clear() } runMigrations(context) assertEquals(true, context.sharedPrefs.getBoolean(PreferenceKeys.SHOW_HIDDEN_FOLDERS, true)) @@ -97,7 +98,7 @@ class MigrationsTest { @Test fun verifyHiddenFoldersMigrationIfEnabled() { - val context = Application.instance.applicationContext + val context = SPMockBuilder().createContext() context.sharedPrefs.edit { clear() putBoolean(PreferenceKeys.SHOW_HIDDEN_FOLDERS, true) @@ -109,7 +110,7 @@ class MigrationsTest { @Test fun verifyClearClipboardHistoryMigration() { - val context = Application.instance.applicationContext + val context = SPMockBuilder().createContext() context.sharedPrefs.edit { clear() putBoolean(PreferenceKeys.CLEAR_CLIPBOARD_20X, true) |