(t *testing.T, s *Store)
| 53 | } |
| 54 | |
| 55 | func commitmentSeed(t *testing.T, s *Store) []string { |
| 56 | t.Helper() |
| 57 | ws := createTestWorkspace(t, s, "Commitment migration") |
| 58 | col := createTestCollection(t, s, ws.ID, "Dates") |
| 59 | var ids []string |
| 60 | for _, kind := range []string{"deadline_soft", "deadline_hard", "check", "window"} { |
| 61 | for _, variant := range []string{"fired", "ended", "floating", "snoozed", "exdates", "allday", "midnight"} { |
| 62 | item := createTestItem(t, s, ws.ID, col.ID, kind+variant, "") |
| 63 | id, ts := newID(), "2026-10-29T12:00:00Z" |
| 64 | start, end := "2026-11-02T09:00:00", "2026-11-02T10:30:00" |
| 65 | if variant == "allday" { |
| 66 | start, end = "2026-11-02", "2026-11-04" |
| 67 | } |
| 68 | if variant == "midnight" { |
| 69 | start, end = "2026-11-02T23:30:00", "2026-11-03T01:00:00" |
| 70 | } |
| 71 | var dtend, tz, nextAt, nextWall, ended, override, fired any = nil, "UTC", "2026-11-02T09:00:00Z", start, nil, nil, nil |
| 72 | if kind == "window" { |
| 73 | dtend = end |
| 74 | } |
| 75 | if variant == "floating" { |
| 76 | tz = nil |
| 77 | } |
| 78 | if variant == "ended" { |
| 79 | nextAt, nextWall, ended = nil, nil, ts |
| 80 | } |
| 81 | if variant == "snoozed" { |
| 82 | override = "2026-11-05T09:00:00Z" |
| 83 | } |
| 84 | if variant == "fired" { |
| 85 | fired = ts |
| 86 | } |
| 87 | ex := "[]" |
| 88 | if variant == "exdates" { |
| 89 | ex = `["2026-11-03T09:00:00"]` |
| 90 | } |
| 91 | s.mustExec(t, `INSERT INTO item_schedules (id,workspace_id,item_id,kind,dtstart,dtend,tz,floating,next_at,next_wall,ended_at,next_override_at,exdates,created_at,updated_at) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)`, id, ws.ID, item.ID, kind, start, dtend, tz, s.dialect.BoolToInt(variant == "floating"), nextAt, nextWall, ended, override, ex, ts, ts) |
| 92 | s.mustExec(t, `INSERT INTO schedule_occurrences (id,schedule_id,occurrence_at,occurrence_wall,state,actor,resolved_at) VALUES (?,?,?,?,'done','user',?)`, newID(), id, "2026-10-28T09:00:00Z", "2026-10-28T09:00:00", ts) |
| 93 | if variant != "ended" { |
| 94 | s.mustExec(t, `INSERT INTO item_reminders (id,workspace_id,item_id,schedule_id,remind_at,fired_at,created_at,updated_at) VALUES (?,?,?,?,?,?,?,?)`, newID(), ws.ID, item.ID, id, ts, fired, ts, ts) |
| 95 | } |
| 96 | ids = append(ids, id) |
| 97 | } |
| 98 | } |
| 99 | return ids |
| 100 | } |
| 101 | |
| 102 | func commitmentOldRows(t *testing.T, s *Store) []string { |
| 103 | t.Helper() |
no test coverage detected