Skip to content

Commit

Permalink
"Start writing test fro closing custom resources"
Browse files Browse the repository at this point in the history
Signed-off-by: Lentumunai-Mark <lentumunai.mark@students.jkuat.ac.ke>
  • Loading branch information
Lentumunai-Mark committed Sep 9, 2024
1 parent 19e0813 commit bff5e19
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import javax.inject.Inject
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.test.runTest
import org.hl7.fhir.r4.model.CarePlan
import org.hl7.fhir.r4.model.Encounter
import org.hl7.fhir.r4.model.Period
import org.hl7.fhir.r4.model.Reference
import org.hl7.fhir.r4.model.Task
Expand Down Expand Up @@ -281,4 +282,22 @@ class FhirResourceUtilTest : RobolectricTest() {

assertEquals(TaskStatus.REQUESTED, task.status)
}

@Test
fun testCloseCustomResources() {
val encounter =
Encounter().apply {
id = "test-Encounter"
period = Period().apply { start = Date().plusDays(-2) }
status = Encounter.EncounterStatus.INPROGRESS
}

runBlocking { fhirEngine.create(encounter) }

coEvery { defaultRepository.update(any()) } just runs

assertEquals(Encounter.EncounterStatus.INPROGRESS, encounter.status)

runBlocking { fhirResourceUtil.closeCustomResources() }
}
}

0 comments on commit bff5e19

Please sign in to comment.