Move a sub-task's end without a time by whole days when its routine moves on (#101)
This commit is contained in:
1 parent
4d833a4da6
commit
b77311dff7
3 files changed
+35
-3
No files matched your search
@@ -2,6 +2,7 @@ package de.jeanlucmakiola.agendula.data.tasks
|
||||
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import de.jeanlucmakiola.agendula.data.tasks.TasksContract.Tasks
|
||||
import de.jeanlucmakiola.agendula.domain.TaskEnd
|
||||
import de.jeanlucmakiola.agendula.domain.TaskStatus
|
||||
import de.jeanlucmakiola.agendula.domain.recurrence.RecurrenceSpec
|
||||
import org.junit.jupiter.api.Test
|
||||
@@ -230,6 +231,21 @@ class SubtaskResetTest {
|
||||
assertThat(sameDay.apply(at("2026-11-10T00:00:00Z"), isAllDay = true)).isEqualTo(at("2026-11-10T00:00:00Z"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `an untimed sub-task end moves by whole days, not by the routine's clock change`() {
|
||||
// An eight-hourly routine moves from 20:00 to 04:00 the next day in Berlin: the untimed due goes to the next day's end.
|
||||
val hourly = SeriesShift(at("2026-11-09T19:00:00Z"), at("2026-11-10T03:00:00Z"), berlin)
|
||||
val node = SubtaskNode(2, false, done, SubtaskDates(null, at("2026-11-09T22:59:59Z")), untimed = TaskEnd.DUE, timeZone = "Europe/Berlin")
|
||||
val reset = SubtaskReset.toReset(1L, hourly) { if (it == 1L) listOf(node) else emptyList() }
|
||||
assertThat(reset.single().dates.due).isEqualTo(at("2026-11-10T22:59:59Z"))
|
||||
// A UTC routine a week on across the end of summer time: the Berlin date's last second, not an hour past it.
|
||||
val weekly = SeriesShift(at("2026-10-19T07:00:00Z"), at("2026-10-26T07:00:00Z"), ZoneOffset.UTC)
|
||||
val start = SubtaskNode(3, false, done, SubtaskDates(at("2026-10-19T22:00:00Z"), at("2026-10-20T12:00:00Z")), untimed = TaskEnd.START, timeZone = "Europe/Berlin")
|
||||
val moved = SubtaskReset.toReset(1L, weekly) { if (it == 1L) listOf(start) else emptyList() }.single().dates
|
||||
assertThat(moved.start).isEqualTo(at("2026-10-26T23:00:00Z"))
|
||||
assertThat(moved.due).isEqualTo(at("2026-10-27T12:00:00Z"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `moving on shifts dated sub-tasks, fresh ones included, and leaves undated fresh ones`() {
|
||||
val shift = SeriesShift(at("2026-11-02T08:00:00Z"), at("2026-11-09T08:00:00Z"), ZoneOffset.UTC)
|
||||
|
||||
Reference in new issue
Block a user