Skip to content

Commit

Permalink
feat: [ANDROAPP-5896] test
Browse files Browse the repository at this point in the history
  • Loading branch information
mmmateos committed Feb 12, 2024
1 parent 5ac6536 commit a85e855
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,16 +127,18 @@ class EventCapturePresenterTest {
@Test
fun `Should delete an event`() {
whenever(eventRepository.deleteEvent()) doReturn Observable.just(true)
whenever(eventRepository.programStage()) doReturn Observable.just("programStage")

presenter.deleteEvent()
verify(view).showSnackBar(any())
verify(view).showSnackBar(any(), any())
verify(view).finishDataEntry()
verifyNoMoreInteractions(view)
}

@Test
fun `Should close form if it could not delete an event`() {
whenever(eventRepository.deleteEvent()) doReturn Observable.just(false)
whenever(eventRepository.programStage()) doReturn Observable.just("programStage")

presenter.deleteEvent()
verify(view).finishDataEntry()
Expand All @@ -149,7 +151,7 @@ class EventCapturePresenterTest {
whenever(eventRepository.updateEventStatus(status)) doReturn Observable.just(true)

presenter.skipEvent()
verify(view).showSnackBar(any())
verify(view).showSnackBar(any(), any())
verify(view).finishDataEntry()
verifyNoMoreInteractions(view)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class EventDetailsIntegrationTest {
private val programStage: ProgramStage = mock {
on { displayName() } doReturn PROGRAM_STAGE_NAME
on { executionDateLabel() } doReturn EXECUTION_DATE
on { uid() } doReturn PROGRAM_STAGE
}
private val catCombo: CategoryCombo = mock {
on { uid() } doReturn CAT_COMBO_UID
Expand Down Expand Up @@ -179,7 +180,7 @@ class EventDetailsIntegrationTest {
enrollmentStatus = enrollmentStatus,
)

private fun provideEventResourcesProvider() = EventDetailResourcesProvider(resourceManager)
private fun provideEventResourcesProvider() = EventDetailResourcesProvider(resourceManager, programStage.uid())

private fun createOrUpdateEventDetails() = CreateOrUpdateEventDetails(
repository = eventDetailsRepository,
Expand All @@ -199,5 +200,6 @@ class EventDetailsIntegrationTest {
const val COORDINATES = "coordinates"
const val CAT_COMBO_UID = "CatComboUid"
const val CAT_OPTION_COMBO_UID = "CategoryOptionComboUid"
const val PROGRAM_STAGE = "programStage"
}
}

0 comments on commit a85e855

Please sign in to comment.