From a85e855595613d931f6d05b6734fea515013e253 Mon Sep 17 00:00:00 2001 From: manu Date: Mon, 12 Feb 2024 14:43:16 +0100 Subject: [PATCH] feat: [ANDROAPP-5896] test --- .../eventCapture/EventCapturePresenterTest.kt | 6 ++++-- .../eventDetails/EventDetailsIntegrationTest.kt | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/src/test/java/org/dhis2/usescases/eventsWithoutRegistration/eventCapture/EventCapturePresenterTest.kt b/app/src/test/java/org/dhis2/usescases/eventsWithoutRegistration/eventCapture/EventCapturePresenterTest.kt index de30ac1bea..971da475e3 100644 --- a/app/src/test/java/org/dhis2/usescases/eventsWithoutRegistration/eventCapture/EventCapturePresenterTest.kt +++ b/app/src/test/java/org/dhis2/usescases/eventsWithoutRegistration/eventCapture/EventCapturePresenterTest.kt @@ -127,9 +127,10 @@ 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) } @@ -137,6 +138,7 @@ class EventCapturePresenterTest { @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() @@ -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) } diff --git a/app/src/test/java/org/dhis2/usescases/eventsWithoutRegistration/eventDetails/EventDetailsIntegrationTest.kt b/app/src/test/java/org/dhis2/usescases/eventsWithoutRegistration/eventDetails/EventDetailsIntegrationTest.kt index 4456be2091..b5bde6d657 100644 --- a/app/src/test/java/org/dhis2/usescases/eventsWithoutRegistration/eventDetails/EventDetailsIntegrationTest.kt +++ b/app/src/test/java/org/dhis2/usescases/eventsWithoutRegistration/eventDetails/EventDetailsIntegrationTest.kt @@ -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 @@ -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, @@ -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" } }