Skip to content

Commit cb3c9bf

Browse files
Add tests for archiving subtree (#734)
1 parent 2bc0072 commit cb3c9bf

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

tests/plenary/ui/mappings/archive_spec.lua

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,31 @@ describe('Archive', function()
3232
' :END:',
3333
}, vim.api.nvim_buf_get_lines(0, 0, -1, false))
3434
end)
35+
36+
it('should set properties on top-level headline when refiling subtree', function()
37+
local file = helpers.create_agenda_file({
38+
'* foobar',
39+
'** baz',
40+
'* foo',
41+
})
42+
43+
vim.cmd([[exe "norm ,o$"]])
44+
-- Pause to finish the archiving
45+
vim.wait(50)
46+
assert.are.same({
47+
'* foo',
48+
}, vim.api.nvim_buf_get_lines(0, 0, -1, false))
49+
50+
vim.cmd(('edit %s'):format(file.filename .. '_archive'))
51+
assert.are.same({
52+
'* foobar',
53+
' :PROPERTIES:',
54+
' :ARCHIVE_TIME: ' .. Date.now():to_string(),
55+
' :ARCHIVE_FILE: ' .. file.filename,
56+
' :ARCHIVE_CATEGORY: ' .. file:get_category(),
57+
' :ARCHIVE_TODO: ',
58+
' :END:',
59+
'** baz',
60+
}, vim.api.nvim_buf_get_lines(0, 0, -1, false))
61+
end)
3562
end)

0 commit comments

Comments
 (0)