diff options
Diffstat (limited to 'test/test_data.lua')
| -rw-r--r-- | test/test_data.lua | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/test_data.lua b/test/test_data.lua index c33e5ae..9612c43 100644 --- a/test/test_data.lua +++ b/test/test_data.lua @@ -117,6 +117,22 @@ assert(#up == 2 and up[2].d == 25, 'eight days from the 18th end on the 25th') assert(#data.calendar_upcoming({ { y = 2026, m = 11, d = 2 } }, { 2026, 10, 28 }, 8) == 1, 'week crosses into next month') +-- Tasks: separate from events so the grid stays appointments-only, merged +-- with them by date for the table. An overdue task is kept (it sorts first), +-- one past the week is cut like an event, and an all-day row sorts before a +-- timed one on the same day, as khal orders them. +assert(#cal.tasks == 3, 'task count, got ' .. tostring(#cal.tasks)) +assert(cal.tasks[1].task and cal.tasks[1].start == nil + and cal.tasks[2].start == '17:00', 'task fields') +local ag = data.calendar_agenda(cal, { 2026, 9, 18 }, 8) +local titles = {} +for i, e in ipairs(ag) do titles[i] = e.title end +assert(table.concat(titles, ',') == 'Overdue chore,A birthday,Dentist,' + .. 'Task due today,Team sync | notes', + 'agenda order, got ' .. table.concat(titles, ',')) +assert(#data.calendar_agenda(empty, { 2026, 9, 18 }, 8) == 0, + 'no events, no tasks: empty agenda') + -- month_shape: September 2026 has 30 days and starts on a Tuesday. -- Monday = 1, so Tuesday = 2. local ndays, first = data.month_shape(2026, 9) |
