Ring on save only for reminders the editor noted, never again for a task that rang (#106)
This commit is contained in:
1 parent
51fbe1f5f9
commit
4a98c2eef6
8 files changed
+105
-62
No files matched your search
@@ -51,10 +51,11 @@ class StoredRemindersTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `a past default of a date the task had already is no news`() {
|
||||
fun `the past defaults follow the ones a save stores`() {
|
||||
val current = testTask(due = now + 1.hours)
|
||||
val form = TaskForm(title = "t", listId = 1, start = now, due = now + 1.hours)
|
||||
assertThat(pastDefaults(form, current)).containsExactly(dayBeforeStart)
|
||||
assertThat(stored(form, current)).containsExactly(hourBeforeDue)
|
||||
assertThat(pastDefaults(form, current)).containsExactly(dayBeforeStart, dayBeforeDue)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -69,16 +70,13 @@ class StoredRemindersTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `a new task from the editor rings the defaults it did not show as past`() {
|
||||
val form = TaskForm(
|
||||
title = "t",
|
||||
listId = 1,
|
||||
start = now,
|
||||
due = now + 5.days,
|
||||
reminders = listOf(dayBeforeDue, hourBeforeDue),
|
||||
remindersChosen = true,
|
||||
)
|
||||
assertThat(pastDefaults(form)).containsExactly(dayBeforeStart)
|
||||
fun `a form from the editor rings the defaults it noted as past`() {
|
||||
val form = TaskForm(title = "t", listId = 1, start = now, due = now + 5.days)
|
||||
val past = StoredReminders.leftOutAsPast(form, null, null, false, settings, now.toEpochMilliseconds(), zone)
|
||||
assertThat(past).containsExactly(dayBeforeStart)
|
||||
val chosen = form.copy(reminders = listOf(dayBeforeDue, hourBeforeDue), remindersChosen = true)
|
||||
assertThat(pastDefaults(chosen.copy(pastReminders = past))).containsExactly(dayBeforeStart)
|
||||
assertThat(pastDefaults(chosen)).isEmpty()
|
||||
}
|
||||
|
||||
private fun pastDefaults(form: TaskForm, current: de.jeanlucmakiola.agendula.domain.Task? = null) =
|
||||
|
||||
Reference in new issue
Block a user