aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/fixtures/calendar_cache3
-rw-r--r--test/test_data.lua16
2 files changed, 19 insertions, 0 deletions
diff --git a/test/fixtures/calendar_cache b/test/fixtures/calendar_cache
index c31ab94..161b091 100644
--- a/test/fixtures/calendar_cache
+++ b/test/fixtures/calendar_cache
@@ -8,3 +8,6 @@ event 18.09.2026|||birthdays|A birthday
event 24.09.2026|14:30|15:30|work|Team sync | notes
event 26.09.2026|||birthdays|Another birthday
event 02.10.2026|09:00|10:00|work|Review
+task 2026-09-16||Overdue chore
+task 2026-09-18|17:00|Task due today
+task 2026-10-30||Task far out
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)