fix tests
This commit is contained in:
parent
9c656cb140
commit
0f5d3b5813
2 changed files with 6 additions and 4 deletions
|
@ -8,6 +8,7 @@ import info.nightscout.database.entities.GlucoseValue
|
||||||
import info.nightscout.interfaces.aps.AutosensDataStore
|
import info.nightscout.interfaces.aps.AutosensDataStore
|
||||||
import info.nightscout.interfaces.bgQualityCheck.BgQualityCheck
|
import info.nightscout.interfaces.bgQualityCheck.BgQualityCheck
|
||||||
import info.nightscout.interfaces.constraints.Constraint
|
import info.nightscout.interfaces.constraints.Constraint
|
||||||
|
import info.nightscout.interfaces.iob.InMemoryGlucoseValue
|
||||||
import info.nightscout.interfaces.iob.IobCobCalculator
|
import info.nightscout.interfaces.iob.IobCobCalculator
|
||||||
import info.nightscout.interfaces.plugin.ActivePlugin
|
import info.nightscout.interfaces.plugin.ActivePlugin
|
||||||
import info.nightscout.interfaces.source.BgSource
|
import info.nightscout.interfaces.source.BgSource
|
||||||
|
@ -218,7 +219,7 @@ class BgQualityCheckPluginTest : TestBase() {
|
||||||
flatData.add(GlucoseValue(raw = 0.0, noise = 0.0, value = 100.0, timestamp = now + T.mins(-40).msecs(), sourceSensor = GlucoseValue.SourceSensor.UNKNOWN, trendArrow = GlucoseValue.TrendArrow.FLAT))
|
flatData.add(GlucoseValue(raw = 0.0, noise = 0.0, value = 100.0, timestamp = now + T.mins(-40).msecs(), sourceSensor = GlucoseValue.SourceSensor.UNKNOWN, trendArrow = GlucoseValue.TrendArrow.FLAT))
|
||||||
flatData.add(GlucoseValue(raw = 0.0, noise = 0.0, value = 100.0, timestamp = now + T.mins(-45).msecs(), sourceSensor = GlucoseValue.SourceSensor.UNKNOWN, trendArrow = GlucoseValue.TrendArrow.FLAT))
|
flatData.add(GlucoseValue(raw = 0.0, noise = 0.0, value = 100.0, timestamp = now + T.mins(-45).msecs(), sourceSensor = GlucoseValue.SourceSensor.UNKNOWN, trendArrow = GlucoseValue.TrendArrow.FLAT))
|
||||||
`when`(autosensDataStore.getBgReadingsDataTableCopy()).thenReturn(flatData)
|
`when`(autosensDataStore.getBgReadingsDataTableCopy()).thenReturn(flatData)
|
||||||
`when`(iobCobCalculator.ads.lastBg()).thenReturn(flatData[0])
|
`when`(iobCobCalculator.ads.lastBg()).thenReturn(InMemoryGlucoseValue(flatData[0]))
|
||||||
|
|
||||||
// Test non-dexcom plugin on flat data
|
// Test non-dexcom plugin on flat data
|
||||||
class OtherPlugin : BgSource {
|
class OtherPlugin : BgSource {
|
||||||
|
@ -247,7 +248,7 @@ class BgQualityCheckPluginTest : TestBase() {
|
||||||
incompleteData.add(GlucoseValue(raw = 0.0, noise = 0.0, value = 100.0, timestamp = now + T.mins(0).msecs(), sourceSensor = GlucoseValue.SourceSensor.UNKNOWN, trendArrow = GlucoseValue.TrendArrow.FLAT))
|
incompleteData.add(GlucoseValue(raw = 0.0, noise = 0.0, value = 100.0, timestamp = now + T.mins(0).msecs(), sourceSensor = GlucoseValue.SourceSensor.UNKNOWN, trendArrow = GlucoseValue.TrendArrow.FLAT))
|
||||||
incompleteData.add(GlucoseValue(raw = 0.0, noise = 0.0, value = 100.0, timestamp = now + T.mins(-5).msecs(), sourceSensor = GlucoseValue.SourceSensor.UNKNOWN, trendArrow = GlucoseValue.TrendArrow.FLAT))
|
incompleteData.add(GlucoseValue(raw = 0.0, noise = 0.0, value = 100.0, timestamp = now + T.mins(-5).msecs(), sourceSensor = GlucoseValue.SourceSensor.UNKNOWN, trendArrow = GlucoseValue.TrendArrow.FLAT))
|
||||||
`when`(autosensDataStore.getBgReadingsDataTableCopy()).thenReturn(incompleteData)
|
`when`(autosensDataStore.getBgReadingsDataTableCopy()).thenReturn(incompleteData)
|
||||||
`when`(iobCobCalculator.ads.lastBg()).thenReturn(incompleteData[0])
|
`when`(iobCobCalculator.ads.lastBg()).thenReturn(InMemoryGlucoseValue(incompleteData[0]))
|
||||||
`when`(activePlugin.activeBgSource).thenReturn(OtherPlugin())
|
`when`(activePlugin.activeBgSource).thenReturn(OtherPlugin())
|
||||||
plugin.processBgData()// must be more than 5 values
|
plugin.processBgData()// must be more than 5 values
|
||||||
Assertions.assertNotEquals(BgQualityCheck.State.FLAT, plugin.state)
|
Assertions.assertNotEquals(BgQualityCheck.State.FLAT, plugin.state)
|
||||||
|
|
|
@ -21,6 +21,7 @@ import info.nightscout.interfaces.aps.Loop
|
||||||
import info.nightscout.interfaces.constraints.Constraint
|
import info.nightscout.interfaces.constraints.Constraint
|
||||||
import info.nightscout.interfaces.constraints.Constraints
|
import info.nightscout.interfaces.constraints.Constraints
|
||||||
import info.nightscout.interfaces.iob.CobInfo
|
import info.nightscout.interfaces.iob.CobInfo
|
||||||
|
import info.nightscout.interfaces.iob.InMemoryGlucoseValue
|
||||||
import info.nightscout.interfaces.iob.IobTotal
|
import info.nightscout.interfaces.iob.IobTotal
|
||||||
import info.nightscout.interfaces.logging.UserEntryLogger
|
import info.nightscout.interfaces.logging.UserEntryLogger
|
||||||
import info.nightscout.interfaces.plugin.ActivePlugin
|
import info.nightscout.interfaces.plugin.ActivePlugin
|
||||||
|
@ -68,7 +69,7 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() {
|
||||||
@Mock lateinit var autosensDataStore: AutosensDataStore
|
@Mock lateinit var autosensDataStore: AutosensDataStore
|
||||||
@Mock lateinit var smsManager: SmsManager
|
@Mock lateinit var smsManager: SmsManager
|
||||||
|
|
||||||
var injector: HasAndroidInjector = HasAndroidInjector {
|
private var injector: HasAndroidInjector = HasAndroidInjector {
|
||||||
AndroidInjector {
|
AndroidInjector {
|
||||||
if (it is PumpEnactResult) {
|
if (it is PumpEnactResult) {
|
||||||
it.context = context
|
it.context = context
|
||||||
|
@ -98,7 +99,7 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() {
|
||||||
|
|
||||||
`when`(iobCobCalculator.getCobInfo(false, "SMS COB")).thenReturn(CobInfo(0, 10.0, 2.0))
|
`when`(iobCobCalculator.getCobInfo(false, "SMS COB")).thenReturn(CobInfo(0, 10.0, 2.0))
|
||||||
`when`(iobCobCalculator.ads).thenReturn(autosensDataStore)
|
`when`(iobCobCalculator.ads).thenReturn(autosensDataStore)
|
||||||
`when`(autosensDataStore.lastBg()).thenReturn(reading)
|
`when`(autosensDataStore.lastBg()).thenReturn(InMemoryGlucoseValue(reading))
|
||||||
|
|
||||||
`when`(sp.getString(R.string.key_smscommunicator_allowednumbers, "")).thenReturn("1234;5678")
|
`when`(sp.getString(R.string.key_smscommunicator_allowednumbers, "")).thenReturn("1234;5678")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue