Skip to content

Commit 55b68bb

Browse files
chore(tests): Add tests for clocking out when done
1 parent 8121c22 commit 55b68bb

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

tests/plenary/ui/clock_spec.lua

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,4 +185,30 @@ describe('Clock', function()
185185
assert.are.same('Test 1', file:get_headlines()[2]:get_title())
186186
assert.is_false(file:get_headlines()[2]:is_clocked_in())
187187
end)
188+
189+
it('should clock out and entry when its marked as done', function()
190+
local file = helpers.create_agenda_file({
191+
'* TODO Test 1',
192+
' Content',
193+
'* TODO Test 2',
194+
' :LOGBOOK:',
195+
' CLOCK: ' .. Date.now():to_wrapped_string(false),
196+
' :END:',
197+
'* TODO Test 3',
198+
})
199+
200+
vim.cmd('edit ' .. file.filename)
201+
vim.fn.cursor({ 3, 1 })
202+
vim.cmd([[norm cit]])
203+
assert.are.same({
204+
'* TODO Test 1',
205+
' Content',
206+
'* DONE Test 2',
207+
' CLOSED: ' .. Date.now():to_wrapped_string(false),
208+
' :LOGBOOK:',
209+
' CLOCK: ' .. Date.now():to_wrapped_string(false) .. '--' .. Date.now():to_wrapped_string(false) .. ' => 0:00',
210+
' :END:',
211+
'* TODO Test 3',
212+
}, vim.api.nvim_buf_get_lines(0, 0, -1, false))
213+
end)
188214
end)

0 commit comments

Comments
 (0)