Skip to content

Commit

Permalink
Improved tests
Browse files Browse the repository at this point in the history
  • Loading branch information
grzesiek2010 committed Apr 26, 2021
1 parent e340560 commit 2bd5f38
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import org.odk.collect.android.formmanagement.InstancesCountRepository
import org.odk.collect.android.injection.config.AppDependencyModule
import org.odk.collect.android.preferences.source.SettingsProvider
import org.odk.collect.android.projects.CurrentProjectProvider
import org.odk.collect.android.projects.ProjectSettingsDialog
import org.odk.collect.android.support.RobolectricHelpers
import org.odk.collect.android.utilities.ApplicationConstants
import org.odk.collect.android.version.VersionInformation
Expand Down Expand Up @@ -62,6 +63,14 @@ class MainMenuActivityTest {
})
}

@Test
fun `MainMenuActivity should implement ProjectSettingsDialogListener`() {
val scenario = ActivityScenario.launch(MainMenuActivity::class.java)
scenario.onActivity { activity: MainMenuActivity ->
assertThat(activity is ProjectSettingsDialog.ProjectSettingsDialogListener, `is`(true))
}
}

@Test
fun `Project icon for current project should be displayed`() {
val scenario = ActivityScenario.launch(MainMenuActivity::class.java)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import org.odk.collect.android.activities.viewmodels.SplashScreenViewModel
import org.odk.collect.android.fragments.dialogs.FirstLaunchDialog
import org.odk.collect.android.injection.config.AppDependencyModule
import org.odk.collect.android.preferences.source.SettingsProvider
import org.odk.collect.android.projects.AddProjectDialog
import org.odk.collect.android.rules.MainCoroutineScopeRule
import org.odk.collect.android.support.RobolectricHelpers
import org.odk.collect.android.utilities.AppStateProvider
Expand All @@ -49,6 +50,16 @@ class SplashScreenActivityTest {
})
}

@Test
fun `SplashScreenActivity should implement AddProjectDialogListener`() {
doReturn(true).`when`(splashScreenViewModel).isFirstLaunch

val scenario = ActivityScenario.launch(SplashScreenActivity::class.java)
scenario.onActivity { activity: SplashScreenActivity ->
assertThat(activity is AddProjectDialog.AddProjectDialogListener, `is`(true))
}
}

@Test
fun `The Fist Launch Screen should be displayed if the app is newly installed`() {
doReturn(true).`when`(splashScreenViewModel).isFirstLaunch
Expand Down

0 comments on commit 2bd5f38

Please sign in to comment.