diff options
| author | Peter Stone <thepeterstone@gmail.com> | 2026-09-03 00:42:09 +0000 |
|---|---|---|
| committer | Peter Stone <thepeterstone@gmail.com> | 2026-09-03 00:42:09 +0000 |
| commit | 96518adb706b65670508b170b50f4bd5e1aeeed8 (patch) | |
| tree | 06efc6f0c010b07f6dffd999011d46c8e7f124cd /internal/models/recurrence_test.go | |
| parent | 10f9fcd271bbac4ff26f32880db212b5bd3b7f00 (diff) | |
Revert "Show one row per recurring chore in the flat task list"
This reverts commit 10f9fcd271bbac4ff26f32880db212b5bd3b7f00.
Diffstat (limited to 'internal/models/recurrence_test.go')
| -rw-r--r-- | internal/models/recurrence_test.go | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/internal/models/recurrence_test.go b/internal/models/recurrence_test.go index affba56..8d18996 100644 --- a/internal/models/recurrence_test.go +++ b/internal/models/recurrence_test.go @@ -49,43 +49,3 @@ func TestComputeNextOccurrence(t *testing.T) { }) } } - -func TestCollapseRecurringSeries_KeepsOnlyEarliestOpenInstance(t *testing.T) { - sep1 := time.Date(2026, 9, 1, 0, 0, 0, 0, time.UTC) - oct1 := time.Date(2026, 10, 1, 0, 0, 0, 0, time.UTC) - - tasks := []Task{ - {ID: "bills-sep", Content: "Bills", DueDate: &sep1, RecurrenceSeriesID: "bills"}, - {ID: "bills-oct", Content: "Bills", DueDate: &oct1, RecurrenceSeriesID: "bills"}, - {ID: "one-off", Content: "Fix curtain holder"}, - } - - got := CollapseRecurringSeries(tasks) - - var ids []string - for _, task := range got { - ids = append(ids, task.ID) - } - if len(got) != 2 { - t.Fatalf("got %d tasks (%v), want 2: one row per recurring series plus the one-off", len(got), ids) - } - if got[0].ID != "bills-sep" { - t.Errorf("kept %q for the Bills series, want bills-sep (the earliest open instance is the one you actually owe)", got[0].ID) - } - if got[1].ID != "one-off" { - t.Errorf("non-recurring task was dropped or reordered: got %q", got[1].ID) - } -} - -func TestCollapseRecurringSeries_UndatedAndDistinctSeriesUntouched(t *testing.T) { - due := time.Date(2026, 9, 1, 0, 0, 0, 0, time.UTC) - tasks := []Task{ - {ID: "a", RecurrenceSeriesID: "series-a", DueDate: &due}, - {ID: "b", RecurrenceSeriesID: "series-b", DueDate: &due}, - {ID: "c", RecurrenceSeriesID: "series-c"}, // recurring but undated - } - - if got := CollapseRecurringSeries(tasks); len(got) != 3 { - t.Errorf("len = %d, want 3 -- distinct series must not collapse into each other", len(got)) - } -} |
