Fix tests

This commit is contained in:
swissalpine 2023-11-30 11:51:36 +01:00 committed by GitHub
parent 46c5e82e6c
commit dad61d5a37
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -81,7 +81,7 @@ class LoopHubTest: TestBase() {
verifyNoMoreInteractions(overviewData)
}
@Test
@Test
fun testCurrentProfile() {
val profile = mock(Profile::class.java)
`when`(profileFunction.getProfile()).thenReturn(profile)
@ -112,6 +112,22 @@ class LoopHubTest: TestBase() {
verify(iobCobCalculator, times(1)).calculateIobFromBolus()
}
@Test
fun testBasalOnBoard() {
val iobBasal = IobTotal(time = 0).apply { basaliob = 23.9 }
`when`(iobCobCalculator.calculateIobFromTempBasalsIncludingConvertedExtended()).thenReturn(iobBasal)
assertEquals(23.9, loopHub.insulinBasalOnboard, 1e-10)
verify(iobCobCalculator, times(1)).calculateIobFromTempBasalsIncludingConvertedExtended()
}
@Test
fun testCarbsOnBoard() {
val cobInfo = CobInfo(0, 12.0, 0.0)
`when`(overviewData.cobInfo(iobCobCalculator)).thenReturn(cobInfo)
assertEquals(12.0, loopHub.carbsOnboard)
verify(overviewData, times(1)).cobInfo(iobCobCalculator)
}
@Test
fun testIsConnected() {
`when`(loop.isDisconnected).thenReturn(false)