diff --git a/spec/filter_spec.lua b/spec/filter_spec.lua index 9038289..8756c5f 100644 --- a/spec/filter_spec.lua +++ b/spec/filter_spec.lua @@ -1,8 +1,8 @@ require('spec.helpers') local config = require('pending.config') -local store = require('pending.store') local diff = require('pending.diff') +local store = require('pending.store') describe('filter', function() local tmpdir @@ -43,8 +43,12 @@ describe('filter', function() local work_task = nil local home_task = nil for _, t in ipairs(tasks) do - if t.category == 'Work' then work_task = t end - if t.category == 'Home' then home_task = t end + if t.category == 'Work' then + work_task = t + end + if t.category == 'Home' then + home_task = t + end end assert.is_not_nil(work_task) assert.is_not_nil(home_task) @@ -62,7 +66,9 @@ describe('filter', function() local tasks = store.active_tasks() local inbox_task = nil for _, t in ipairs(tasks) do - if t.category ~= 'Work' then inbox_task = t end + if t.category ~= 'Work' then + inbox_task = t + end end assert.is_not_nil(inbox_task) assert.is_true(hidden[inbox_task.id]) @@ -79,9 +85,15 @@ describe('filter', function() local tasks = store.active_tasks() local overdue_task, future_task, nodue_task for _, t in ipairs(tasks) do - if t.due == '2020-01-01' then overdue_task = t end - if t.due == '2099-01-01' then future_task = t end - if not t.due then nodue_task = t end + if t.due == '2020-01-01' then + overdue_task = t + end + if t.due == '2099-01-01' then + future_task = t + end + if not t.due then + nodue_task = t + end end assert.is_nil(hidden[overdue_task.id]) assert.is_true(hidden[future_task.id]) @@ -100,9 +112,15 @@ describe('filter', function() local tasks = store.active_tasks() local today_task, old_task, future_task for _, t in ipairs(tasks) do - if t.due == today then today_task = t end - if t.due == '2020-01-01' then old_task = t end - if t.due == '2099-01-01' then future_task = t end + if t.due == today then + today_task = t + end + if t.due == '2020-01-01' then + old_task = t + end + if t.due == '2099-01-01' then + future_task = t + end end assert.is_nil(hidden[today_task.id]) assert.is_true(hidden[old_task.id]) @@ -119,8 +137,12 @@ describe('filter', function() local tasks = store.active_tasks() local important_task, normal_task for _, t in ipairs(tasks) do - if t.priority and t.priority > 0 then important_task = t end - if not t.priority or t.priority == 0 then normal_task = t end + if t.priority and t.priority > 0 then + important_task = t + end + if not t.priority or t.priority == 0 then + normal_task = t + end end assert.is_nil(hidden[important_task.id]) assert.is_true(hidden[normal_task.id]) @@ -137,9 +159,15 @@ describe('filter', function() local tasks = store.active_tasks() local work_overdue, work_future, home_overdue for _, t in ipairs(tasks) do - if t.description == 'Work overdue' then work_overdue = t end - if t.description == 'Work future' then work_future = t end - if t.description == 'Home overdue' then home_overdue = t end + if t.description == 'Work overdue' then + work_overdue = t + end + if t.description == 'Work future' then + work_future = t + end + if t.description == 'Home overdue' then + home_overdue = t + end end assert.is_nil(hidden[work_overdue.id]) assert.is_true(hidden[work_future.id]) @@ -181,7 +209,9 @@ describe('filter', function() local tasks = store.active_tasks() local home_task for _, t in ipairs(tasks) do - if t.category == 'Home' then home_task = t end + if t.category == 'Home' then + home_task = t + end end assert.is_true(hidden[home_task.id]) end) @@ -196,7 +226,9 @@ describe('filter', function() local tasks = store.active_tasks() local hidden_task for _, t in ipairs(tasks) do - if t.description == 'Hidden task' then hidden_task = t end + if t.description == 'Hidden task' then + hidden_task = t + end end local hidden_ids = { [hidden_task.id] = true } local lines = { @@ -217,8 +249,12 @@ describe('filter', function() local tasks = store.active_tasks() local keep_task, delete_task for _, t in ipairs(tasks) do - if t.description == 'Keep task' then keep_task = t end - if t.description == 'Delete task' then delete_task = t end + if t.description == 'Keep task' then + keep_task = t + end + if t.description == 'Delete task' then + delete_task = t + end end local lines = { '/' .. keep_task.id .. '/- [ ] Keep task',