fix tests

This commit is contained in:
Milos Kozak 2023-02-13 14:15:25 +01:00
parent 266ca2079d
commit 279fe6f94b
4 changed files with 13 additions and 11 deletions

View file

@ -2,6 +2,7 @@ package info.nightscout.core.graph.data
import android.content.Context import android.content.Context
import android.graphics.Color import android.graphics.Color
import info.nightscout.database.entities.GlucoseValue
import info.nightscout.interfaces.GlucoseUnit import info.nightscout.interfaces.GlucoseUnit
import info.nightscout.interfaces.iob.InMemoryGlucoseValue import info.nightscout.interfaces.iob.InMemoryGlucoseValue
import info.nightscout.interfaces.profile.DefaultValueHelper import info.nightscout.interfaces.profile.DefaultValueHelper
@ -35,7 +36,7 @@ internal class InMemoryGlucoseValueDataPointTest {
} }
@Test @Test
fun alphaShouldBeAddedForFilledGaps() { fun alphaShouldBeAddedForFilledGaps() {
val gv = InMemoryGlucoseValue(1000, 100.0) val gv = InMemoryGlucoseValue(1000, 100.0, sourceSensor = GlucoseValue.SourceSensor.UNKNOWN)
val sut = InMemoryGlucoseValueDataPoint(gv, defaultValueHelper, profileFunction, rh) val sut = InMemoryGlucoseValueDataPoint(gv, defaultValueHelper, profileFunction, rh)
var alpha = sut.color(context).ushr(24) var alpha = sut.color(context).ushr(24)

View file

@ -82,7 +82,7 @@ class TriggerBgTest : TriggerTestBase() {
private fun generateOneCurrentRecordBgData(): MutableList<InMemoryGlucoseValue> { private fun generateOneCurrentRecordBgData(): MutableList<InMemoryGlucoseValue> {
val list: MutableList<InMemoryGlucoseValue> = ArrayList() val list: MutableList<InMemoryGlucoseValue> = ArrayList()
list.add(InMemoryGlucoseValue(value = 214.0, timestamp = now - 1, trendArrow = GlucoseValue.TrendArrow.FLAT)) list.add(InMemoryGlucoseValue(value = 214.0, timestamp = now - 1, trendArrow = GlucoseValue.TrendArrow.FLAT, sourceSensor = GlucoseValue.SourceSensor.UNKNOWN))
return list return list
} }
} }

View file

@ -91,14 +91,14 @@ class TriggerDeltaTest : TriggerTestBase() {
private fun generateValidBgData(): MutableList<InMemoryGlucoseValue> { private fun generateValidBgData(): MutableList<InMemoryGlucoseValue> {
val list: MutableList<InMemoryGlucoseValue> = ArrayList() val list: MutableList<InMemoryGlucoseValue> = ArrayList()
list.add(InMemoryGlucoseValue(value = 214.0, timestamp = 1514766900000, trendArrow = GlucoseValue.TrendArrow.FLAT)) list.add(InMemoryGlucoseValue(value = 214.0, timestamp = 1514766900000, trendArrow = GlucoseValue.TrendArrow.FLAT, sourceSensor = GlucoseValue.SourceSensor.UNKNOWN))
list.add(InMemoryGlucoseValue(value = 216.0, timestamp = 1514766600000, trendArrow = GlucoseValue.TrendArrow.FLAT)) list.add(InMemoryGlucoseValue(value = 216.0, timestamp = 1514766600000, trendArrow = GlucoseValue.TrendArrow.FLAT, sourceSensor = GlucoseValue.SourceSensor.UNKNOWN))
list.add(InMemoryGlucoseValue(value = 219.0, timestamp = 1514766300000, trendArrow = GlucoseValue.TrendArrow.FLAT)) list.add(InMemoryGlucoseValue(value = 219.0, timestamp = 1514766300000, trendArrow = GlucoseValue.TrendArrow.FLAT, sourceSensor = GlucoseValue.SourceSensor.UNKNOWN))
list.add(InMemoryGlucoseValue(value = 223.0, timestamp = 1514766000000, trendArrow = GlucoseValue.TrendArrow.FLAT)) list.add(InMemoryGlucoseValue(value = 223.0, timestamp = 1514766000000, trendArrow = GlucoseValue.TrendArrow.FLAT, sourceSensor = GlucoseValue.SourceSensor.UNKNOWN))
list.add(InMemoryGlucoseValue(value = 222.0, timestamp = 1514765700000, trendArrow = GlucoseValue.TrendArrow.FLAT)) list.add(InMemoryGlucoseValue(value = 222.0, timestamp = 1514765700000, trendArrow = GlucoseValue.TrendArrow.FLAT, sourceSensor = GlucoseValue.SourceSensor.UNKNOWN))
list.add(InMemoryGlucoseValue(value = 224.0, timestamp = 1514765400000, trendArrow = GlucoseValue.TrendArrow.FLAT)) list.add(InMemoryGlucoseValue(value = 224.0, timestamp = 1514765400000, trendArrow = GlucoseValue.TrendArrow.FLAT, sourceSensor = GlucoseValue.SourceSensor.UNKNOWN))
list.add(InMemoryGlucoseValue(value = 226.0, timestamp = 1514765100000, trendArrow = GlucoseValue.TrendArrow.FLAT)) list.add(InMemoryGlucoseValue(value = 226.0, timestamp = 1514765100000, trendArrow = GlucoseValue.TrendArrow.FLAT, sourceSensor = GlucoseValue.SourceSensor.UNKNOWN))
list.add(InMemoryGlucoseValue(value = 228.0, timestamp = 1514764800000, trendArrow = GlucoseValue.TrendArrow.FLAT)) list.add(InMemoryGlucoseValue(value = 228.0, timestamp = 1514764800000, trendArrow = GlucoseValue.TrendArrow.FLAT, sourceSensor = GlucoseValue.SourceSensor.UNKNOWN))
return list return list
} }
} }

View file

@ -5,6 +5,7 @@ import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.BundleMock import info.nightscout.androidaps.BundleMock
import info.nightscout.androidaps.TestBaseWithProfile import info.nightscout.androidaps.TestBaseWithProfile
import info.nightscout.androidaps.TestPumpPlugin import info.nightscout.androidaps.TestPumpPlugin
import info.nightscout.database.entities.GlucoseValue
import info.nightscout.database.entities.TemporaryBasal import info.nightscout.database.entities.TemporaryBasal
import info.nightscout.interfaces.GlucoseUnit import info.nightscout.interfaces.GlucoseUnit
import info.nightscout.interfaces.aps.AutosensDataStore import info.nightscout.interfaces.aps.AutosensDataStore
@ -49,7 +50,7 @@ internal class DataBroadcastPluginTest : TestBaseWithProfile() {
loop, activePlugin, receiverStatusStore, config, glucoseStatusProvider loop, activePlugin, receiverStatusStore, config, glucoseStatusProvider
) )
Mockito.`when`(iobCobCalculator.ads).thenReturn(autosensDataStore) Mockito.`when`(iobCobCalculator.ads).thenReturn(autosensDataStore)
Mockito.`when`(autosensDataStore.lastBg()).thenReturn(InMemoryGlucoseValue(1000, 100.0)) Mockito.`when`(autosensDataStore.lastBg()).thenReturn(InMemoryGlucoseValue(1000, 100.0, sourceSensor = GlucoseValue.SourceSensor.UNKNOWN))
Mockito.`when`(profileFunction.getProfile()).thenReturn(validProfile) Mockito.`when`(profileFunction.getProfile()).thenReturn(validProfile)
Mockito.`when`(profileFunction.getUnits()).thenReturn(GlucoseUnit.MGDL) Mockito.`when`(profileFunction.getUnits()).thenReturn(GlucoseUnit.MGDL)
Mockito.`when`(profileFunction.getProfileName()).thenReturn("TestProfile") Mockito.`when`(profileFunction.getProfileName()).thenReturn("TestProfile")