Fix unit tests, small improvements

This commit is contained in:
jbr7rr 2023-06-26 20:44:14 +02:00
parent 19b9ca1da4
commit ef2cc13dd8
5 changed files with 11 additions and 9 deletions

View file

@ -412,7 +412,6 @@ import kotlin.math.round
override fun timezoneOrDSTChanged(timeChangeType: TimeChangeType) {
medtrumPump.needTimeUpdate = true
// Update status to sync time with pump
if (isInitialized()) {
commandQueue.updateTime(object : Callback() {
override fun run() {

View file

@ -41,14 +41,14 @@
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/text_press_next"
android:id="@+id/text_press_next_to_start_activation"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:layout_marginTop="5dp"
android:layout_marginEnd="5dp"
android:gravity="center"
android:text="@string/press_next"
android:text="@string/press_next_to_start_activation"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"

View file

@ -78,8 +78,9 @@
<string name="pump_time_update_failed">Failed to update pump timezone, snooze message and refresh manually.</string>
<!-- wizard-->
<string name="string_start_complete">Complete</string>
<string name="string_start_deactivate">Deactivate patch</string>
<string name="retry">Retry</string>
<string name="next">Next</string>
<string name="discard">Discard</string>
<string name ="step_prepare_patch">Activate Patch</string>
<string name ="step_prepare_patch_connect">Connect and Fill</string>
@ -96,7 +97,7 @@
<string name="base_serial">Pump Base Serial: %1$X</string>
<string name="patch_begin_activation">No active patch. Press <b>Next</b> to begin the activation process.</string>
<string name="patch_not_active_note">Pump base should not be connected to the patch unil the next step!</string>
<string name="patch_not_active_note">Pump base should not be connected to the patch until the next step!</string>
<string name="connect_pump_base">Connect pump base to a new patch, remove the residual air and fill with insulin, then press <b>Next</b>.</string>
<string name="note_min_70_units">Note: A minimum of 70 units is required for actvation.</string>
<string name="do_not_attach_to_body">Do not attach the patch to the body yet.</string>
@ -104,6 +105,7 @@
<string name="wait_for_priming">Please wait for the priming to complete.</string>
<string name="priming_error">Failed to prime, press <b>Retry</b> to try again.</string>
<string name="press_next">Press <b>Next</b> to continue.</string>
<string name="press_next_to_start_activation">Press <b>Next</b> to start activation.</string>
<string name='attach_patch_to_body'>Remove the safety lock. Attach the pump to the body. Press the needle button.</string>
<string name="remove_safety_lock">Remove the safety lock. Attach the pump to the body. Press the needle button.</string>
<string name="activating_pump">Activating pump and settng initial basal rate. Please Wait.</string>

View file

@ -21,6 +21,6 @@ open class MedtrumTestBase: TestBaseWithProfile() {
@BeforeEach
fun setup() {
medtrumPump = MedtrumPump(aapsLogger, sp, dateUtil, pumpSync, temporaryBasalStorage)
medtrumPump = MedtrumPump(aapsLogger, rh, sp, dateUtil, pumpSync, temporaryBasalStorage)
}
}

View file

@ -19,6 +19,7 @@ class SetTimeZonePacketTest : MedtrumTestBase() {
}
if (it is SetTimeZonePacket) {
it.dateUtil = dateUtil
it.medtrumPump = medtrumPump
}
}
}
@ -41,14 +42,14 @@ class SetTimeZonePacketTest : MedtrumTestBase() {
@Test fun handleResponseGivenPacketWhenValuesSetThenReturnCorrectValues() {
// Inputs
val response = byteArrayOf(7, 10, 3, 0, 0, 0, -38)
val response = byteArrayOf(7, 12, 4, 0, 0, 0, -78)
// Call
val packet = SetTimeZonePacket(packetInjector)
val result = packet.handleResponse(response)
// Expected values
val expectedOffsetMins = dateUtil.getTimeZoneOffsetMinutes(dateUtil.now())
val expectedOffsetMins = 0
assertTrue(result)
assertEquals(expectedOffsetMins, medtrumPump.pumpTimeZoneOffset)