ci: format
This commit is contained in:
parent
040a0bfe02
commit
b37154b173
1 changed files with 55 additions and 19 deletions
|
|
@ -1,8 +1,8 @@
|
||||||
require('spec.helpers')
|
require('spec.helpers')
|
||||||
|
|
||||||
local config = require('pending.config')
|
local config = require('pending.config')
|
||||||
local store = require('pending.store')
|
|
||||||
local diff = require('pending.diff')
|
local diff = require('pending.diff')
|
||||||
|
local store = require('pending.store')
|
||||||
|
|
||||||
describe('filter', function()
|
describe('filter', function()
|
||||||
local tmpdir
|
local tmpdir
|
||||||
|
|
@ -43,8 +43,12 @@ describe('filter', function()
|
||||||
local work_task = nil
|
local work_task = nil
|
||||||
local home_task = nil
|
local home_task = nil
|
||||||
for _, t in ipairs(tasks) do
|
for _, t in ipairs(tasks) do
|
||||||
if t.category == 'Work' then work_task = t end
|
if t.category == 'Work' then
|
||||||
if t.category == 'Home' then home_task = t end
|
work_task = t
|
||||||
|
end
|
||||||
|
if t.category == 'Home' then
|
||||||
|
home_task = t
|
||||||
|
end
|
||||||
end
|
end
|
||||||
assert.is_not_nil(work_task)
|
assert.is_not_nil(work_task)
|
||||||
assert.is_not_nil(home_task)
|
assert.is_not_nil(home_task)
|
||||||
|
|
@ -62,7 +66,9 @@ describe('filter', function()
|
||||||
local tasks = store.active_tasks()
|
local tasks = store.active_tasks()
|
||||||
local inbox_task = nil
|
local inbox_task = nil
|
||||||
for _, t in ipairs(tasks) do
|
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
|
end
|
||||||
assert.is_not_nil(inbox_task)
|
assert.is_not_nil(inbox_task)
|
||||||
assert.is_true(hidden[inbox_task.id])
|
assert.is_true(hidden[inbox_task.id])
|
||||||
|
|
@ -79,9 +85,15 @@ describe('filter', function()
|
||||||
local tasks = store.active_tasks()
|
local tasks = store.active_tasks()
|
||||||
local overdue_task, future_task, nodue_task
|
local overdue_task, future_task, nodue_task
|
||||||
for _, t in ipairs(tasks) do
|
for _, t in ipairs(tasks) do
|
||||||
if t.due == '2020-01-01' then overdue_task = t end
|
if t.due == '2020-01-01' then
|
||||||
if t.due == '2099-01-01' then future_task = t end
|
overdue_task = t
|
||||||
if not t.due then nodue_task = t end
|
end
|
||||||
|
if t.due == '2099-01-01' then
|
||||||
|
future_task = t
|
||||||
|
end
|
||||||
|
if not t.due then
|
||||||
|
nodue_task = t
|
||||||
|
end
|
||||||
end
|
end
|
||||||
assert.is_nil(hidden[overdue_task.id])
|
assert.is_nil(hidden[overdue_task.id])
|
||||||
assert.is_true(hidden[future_task.id])
|
assert.is_true(hidden[future_task.id])
|
||||||
|
|
@ -100,9 +112,15 @@ describe('filter', function()
|
||||||
local tasks = store.active_tasks()
|
local tasks = store.active_tasks()
|
||||||
local today_task, old_task, future_task
|
local today_task, old_task, future_task
|
||||||
for _, t in ipairs(tasks) do
|
for _, t in ipairs(tasks) do
|
||||||
if t.due == today then today_task = t end
|
if t.due == today then
|
||||||
if t.due == '2020-01-01' then old_task = t end
|
today_task = t
|
||||||
if t.due == '2099-01-01' then future_task = t end
|
end
|
||||||
|
if t.due == '2020-01-01' then
|
||||||
|
old_task = t
|
||||||
|
end
|
||||||
|
if t.due == '2099-01-01' then
|
||||||
|
future_task = t
|
||||||
|
end
|
||||||
end
|
end
|
||||||
assert.is_nil(hidden[today_task.id])
|
assert.is_nil(hidden[today_task.id])
|
||||||
assert.is_true(hidden[old_task.id])
|
assert.is_true(hidden[old_task.id])
|
||||||
|
|
@ -119,8 +137,12 @@ describe('filter', function()
|
||||||
local tasks = store.active_tasks()
|
local tasks = store.active_tasks()
|
||||||
local important_task, normal_task
|
local important_task, normal_task
|
||||||
for _, t in ipairs(tasks) do
|
for _, t in ipairs(tasks) do
|
||||||
if t.priority and t.priority > 0 then important_task = t end
|
if t.priority and t.priority > 0 then
|
||||||
if not t.priority or t.priority == 0 then normal_task = t end
|
important_task = t
|
||||||
|
end
|
||||||
|
if not t.priority or t.priority == 0 then
|
||||||
|
normal_task = t
|
||||||
|
end
|
||||||
end
|
end
|
||||||
assert.is_nil(hidden[important_task.id])
|
assert.is_nil(hidden[important_task.id])
|
||||||
assert.is_true(hidden[normal_task.id])
|
assert.is_true(hidden[normal_task.id])
|
||||||
|
|
@ -137,9 +159,15 @@ describe('filter', function()
|
||||||
local tasks = store.active_tasks()
|
local tasks = store.active_tasks()
|
||||||
local work_overdue, work_future, home_overdue
|
local work_overdue, work_future, home_overdue
|
||||||
for _, t in ipairs(tasks) do
|
for _, t in ipairs(tasks) do
|
||||||
if t.description == 'Work overdue' then work_overdue = t end
|
if t.description == 'Work overdue' then
|
||||||
if t.description == 'Work future' then work_future = t end
|
work_overdue = t
|
||||||
if t.description == 'Home overdue' then home_overdue = t end
|
end
|
||||||
|
if t.description == 'Work future' then
|
||||||
|
work_future = t
|
||||||
|
end
|
||||||
|
if t.description == 'Home overdue' then
|
||||||
|
home_overdue = t
|
||||||
|
end
|
||||||
end
|
end
|
||||||
assert.is_nil(hidden[work_overdue.id])
|
assert.is_nil(hidden[work_overdue.id])
|
||||||
assert.is_true(hidden[work_future.id])
|
assert.is_true(hidden[work_future.id])
|
||||||
|
|
@ -181,7 +209,9 @@ describe('filter', function()
|
||||||
local tasks = store.active_tasks()
|
local tasks = store.active_tasks()
|
||||||
local home_task
|
local home_task
|
||||||
for _, t in ipairs(tasks) do
|
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
|
end
|
||||||
assert.is_true(hidden[home_task.id])
|
assert.is_true(hidden[home_task.id])
|
||||||
end)
|
end)
|
||||||
|
|
@ -196,7 +226,9 @@ describe('filter', function()
|
||||||
local tasks = store.active_tasks()
|
local tasks = store.active_tasks()
|
||||||
local hidden_task
|
local hidden_task
|
||||||
for _, t in ipairs(tasks) do
|
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
|
end
|
||||||
local hidden_ids = { [hidden_task.id] = true }
|
local hidden_ids = { [hidden_task.id] = true }
|
||||||
local lines = {
|
local lines = {
|
||||||
|
|
@ -217,8 +249,12 @@ describe('filter', function()
|
||||||
local tasks = store.active_tasks()
|
local tasks = store.active_tasks()
|
||||||
local keep_task, delete_task
|
local keep_task, delete_task
|
||||||
for _, t in ipairs(tasks) do
|
for _, t in ipairs(tasks) do
|
||||||
if t.description == 'Keep task' then keep_task = t end
|
if t.description == 'Keep task' then
|
||||||
if t.description == 'Delete task' then delete_task = t end
|
keep_task = t
|
||||||
|
end
|
||||||
|
if t.description == 'Delete task' then
|
||||||
|
delete_task = t
|
||||||
|
end
|
||||||
end
|
end
|
||||||
local lines = {
|
local lines = {
|
||||||
'/' .. keep_task.id .. '/- [ ] Keep task',
|
'/' .. keep_task.id .. '/- [ ] Keep task',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue