test: add missing coverage (#19)
* test: add top-priority missing test coverage Problem: several critical code paths had zero test coverage — parse.resolve_date (relative date resolution), store.snapshot (foundation of the undo stack), and the diff.apply invariant that unchanged tasks do not get their modified timestamp bumped. The diff.apply due/priority clearing paths were also untested. Solution: add six targeted test blocks across parse_spec, store_spec, and diff_spec: resolve_date happy/failure paths, parse.body with relative due tokens, snapshot copy-semantics and deleted-task exclusion, diff unchanged-modified invariant, due cleared on removal, priority cleared on ! removal. * test: add second batch of missing test coverage Problem: six more gaps from the audit remained after the first batch — archive persistence verification, diff modified-on-rename, parse_buffer inline cat:/due: token parsing, and store.update immutability invariants. Solution: add six it() blocks across archive_spec, diff_spec, and store_spec: archive unload/reload persistence check, modified timestamp updated on description change, inline cat: overrides header category, inline due: token parsed from buffer line, id/entry fields immutable under store.update, and end timestamp not overwritten on second completion.
This commit is contained in:
parent
0ede508af8
commit
114048298b
3 changed files with 68 additions and 0 deletions
|
|
@ -128,4 +128,13 @@ describe('archive', function()
|
|||
assert.is_true(descs['Keep pending'])
|
||||
assert.is_true(descs['Keep recent done'])
|
||||
end)
|
||||
|
||||
it('persists archived tasks to disk after unload/reload', function()
|
||||
local t = store.add({ description = 'Archived task' })
|
||||
store.update(t.id, { status = 'done', ['end'] = '2020-01-01T00:00:00Z' })
|
||||
pending.archive()
|
||||
store.unload()
|
||||
store.load()
|
||||
assert.are.equal(0, #store.active_tasks())
|
||||
end)
|
||||
end)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue