Skip to content

Commit

Permalink
Fix flakey test.
Browse files Browse the repository at this point in the history
Signed-off-by: Lentumunai-Mark <[email protected]>
  • Loading branch information
Lentumunai-Mark committed Mar 4, 2024
1 parent 5e9453f commit 209a900
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -256,11 +256,16 @@ class PatientExtensionTest : RobolectricTest() {

@Test
fun testExtractAgeShouldReturnCallGetAgeStringFromDaysWhenPatientHasBirthDate() {
val currentDate = LocalDate.now()

val oneYearAgo = currentDate.minusYears(1)

val calendar =
Calendar.getInstance().apply { timeInMillis = (timeInMillis - (1L * 365 * 24 * 3600 * 1000)) }
Calendar.getInstance().apply {
timeInMillis = oneYearAgo.atStartOfDay(ZoneId.systemDefault()).toInstant().toEpochMilli()
}

val patient = Patient().apply { birthDate = calendar.time }

Assert.assertEquals("1y", patient.extractAge(context))
}

Expand Down

0 comments on commit 209a900

Please sign in to comment.