Persistent reminders: own record store and key, wait for the startup gate, skip postponed tasks (#100)

This commit is contained in:
makiolaj committed 2026-11-17 10:54:07 +01:00
1 parent 150f10eead
commit 1ccbd003ac
6 files changed
+229 -131

No files matched your search

@@ -7,15 +7,22 @@ class PersistentRecordTest {
@Test
fun `record round-trips`() {
val record = PersistentRecord("own", 42L, ScheduledReminder.NO_OCCURRENCE, 1_700_000_000_000L, misses = 2)
val record = PersistentRecord("own", 42L, 1_700_000_000_000L, due = 1_700_000_900_000L, postedAt = 1_700_000_100_000L, missingSince = 5L)
assertThat(PersistentRecord.decode(record.encode())).isEqualTo(record)
}
@Test
fun `record without due or occurrence round-trips`() {
val record = PersistentRecord("external", 7L, ScheduledReminder.NO_OCCURRENCE, due = null, postedAt = 1L)
assertThat(PersistentRecord.decode(record.encode())).isEqualTo(record)
}
@Test
fun `malformed records decode to null`() {
assertThat(PersistentRecord.decode("own|42|1|2")).isNull()
assertThat(PersistentRecord.decode("|42|1|2|0")).isNull()
assertThat(PersistentRecord.decode("own|x|1|2|0")).isNull()
assertThat(PersistentRecord.decode("own|42|1|2|0|9")).isNull()
assertThat(PersistentRecord.decode("own|42|1||2")).isNull()
assertThat(PersistentRecord.decode("|42|1||2|0")).isNull()
assertThat(PersistentRecord.decode("own|x|1||2|0")).isNull()
assertThat(PersistentRecord.decode("own|42|1|x|2|0")).isNull()
assertThat(PersistentRecord.decode("own|42|1||2|0|9")).isNull()
}
}