Skip to content

Commit

Permalink
Update HivRegisterDaoTest.kt
Browse files Browse the repository at this point in the history
  • Loading branch information
sevenreup committed Jan 31, 2024
1 parent 3964c47 commit 55d7c4c
Showing 1 changed file with 19 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -349,21 +349,34 @@ internal class HivRegisterDaoTest : RobolectricTest() {
}
assertNotNull(data)
val hivProfileData = data as ProfileData.HivProfileData
val order = hivProfileData.tasks.none { it.clinicVisitOrder("https://d-tree.org") == null }
val order = hivProfileData.tasks.none { it.clinicVisitOrder("") != null }
Assert.assertEquals(hivProfileData.tasks.isEmpty(), false)
val sorted = hivProfileData.tasks.sortedWith(compareBy { it.description }).isEmpty()
val sortedIds = hivProfileData.tasks.map { it.id }

assertFalse(sorted)
assertEquals(order, true)
assertEquals(listOf("2", "1"), sortedIds)
Assert.assertFalse(sorted)
Assert.assertEquals(order, true)
assertEquals("50y", hivProfileData.age)
assertEquals("Dist 1 City 1", hivProfileData.address)
assertEquals("John Doe", hivProfileData.name)
assertEquals("practitioner/1234", hivProfileData.chwAssigned.reference)
assertEquals(HealthStatus.EXPOSED_INFANT, hivProfileData.healthStatus)
assertEquals(Enumerations.AdministrativeGender.MALE, hivProfileData.gender)
}
@Test
fun testProfileTaskList() {
val data = runBlocking {
hivRegisterDao.loadProfileData(appFeatureName = "HIV", resourceId = "1")
}
assertNotNull(data)
val hivProfileData = data as ProfileData.HivProfileData
val order = hivProfileData.tasks.none { it.clinicVisitOrder("https://d-tree.org") == null }
Assert.assertEquals(hivProfileData.tasks.isEmpty(), false)
val sorted = hivProfileData.tasks.sortedWith(compareBy { it.description }).isEmpty()
val sortedIds = hivProfileData.tasks.map { it.id }

assertFalse(sorted)
assertEquals(order, true)
assertEquals(listOf("2", "1"), sortedIds)
}

@Test
fun `loadGuardiansRegisterData returns from relatedPersons`() = runTest {
Expand Down

0 comments on commit 55d7c4c

Please sign in to comment.