fix(overview): Hide stale cached age on live cards

This commit is contained in:
darken
2026-04-14 11:28:41 +02:00
committed by Matthias Urhahn
parent 1cd8ae5ace
commit a4e1a3ba2e
4 changed files with 34 additions and 2 deletions
@@ -134,5 +134,25 @@ class ToCachedStateTest : BaseTest() {
)
liveDevice().toCachedState(existing, now).shouldNotBeNull()
}
@Test
fun `returns new state when a live slot refreshes an old cached timestamp`() {
val existing = CachedDeviceState(
profileId = "test-profile",
model = PodModel.AIRPODS_PRO3,
left = CachedDeviceState.CachedBatterySlot(0.8f, now.minusSeconds(10)),
right = CachedDeviceState.CachedBatterySlot(0.7f, now.minusSeconds(10)),
case = CachedDeviceState.CachedBatterySlot(0.5f, now.minusSeconds(177 * 60 * 60)),
isLeftCharging = false,
isRightCharging = false,
isCaseCharging = false,
isHeadsetCharging = false,
lastSeenAt = now.minusSeconds(10),
)
liveDevice(leftBattery = 0.8f, rightBattery = 0.7f, caseBattery = 0.5f)
.toCachedState(existing, now)
.shouldNotBeNull()
}
}
}