test: complete goto_reply fixture and assertion (#11)#20
Conversation
There was a problem hiding this comment.
Code Review
This pull request adds a new test fixture with quoted lines and updates the goto_reply test to verify that the cursor jumps to a quoted line. The feedback suggests improving the test's robustness by asserting the exact line number of the first quote and adding a test case to handle scenarios where no quotes are present.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| local buf = load_fixture('draft_with_quotes.txt') | ||
| nav.goto_reply() | ||
| local pos = vim.api.nvim_win_get_cursor(0) | ||
| local line = vim.api.nvim_buf_get_lines(buf, pos[1] - 1, pos[1], false)[1] | ||
| assert.is_truthy(line:match('^>')) | ||
| vim.api.nvim_buf_delete(buf, { force = true }) |
There was a problem hiding this comment.
To make the test suite more robust and ensure correct behavior, we should:
- Assert the exact line number (
8) to verify thatgoto_reply()indeed jumps to the first quoted line, rather than just any line starting with>. - Add a test case to verify that the cursor does not move if there are no quoted lines in the buffer.
local buf = load_fixture('draft_with_quotes.txt')
nav.goto_reply()
local pos = vim.api.nvim_win_get_cursor(0)
assert.are.equal(8, pos[1])
local line = vim.api.nvim_buf_get_lines(buf, pos[1] - 1, pos[1], false)[1]
assert.is_truthy(line:match('^>'))
vim.api.nvim_buf_delete(buf, { force = true })
end)
it('does not move cursor if there are no quotes', function()
local buf = vim.api.nvim_create_buf(false, true)
vim.api.nvim_buf_set_lines(buf, 0, -1, false, {
'From: me@example.com',
'To: alice@example.com',
'',
'Hello Alice,',
'This is a draft with no quotes.',
})
vim.api.nvim_set_current_buf(buf)
vim.api.nvim_win_set_cursor(0, { 4, 0 })
nav.goto_reply()
local pos = vim.api.nvim_win_get_cursor(0)
assert.are.equal(4, pos[1])
vim.api.nvim_buf_delete(buf, { force = true })
Addresses gemini-code-assist review feedback on PR #20: - Assert cursor lands on line 8 (first `>` in draft_with_quotes.txt), not just any `^>` line. - Add negative test: no quoted lines → cursor does not move.
|
Addressed in follow-up commit
All 9 navigate_spec tests pass; full suite |
Closes #11
Add fixture
tests/mail/fixtures/draft_with_quotes.txtwith a realistic reply draft containing>-quoted lines, and rewrite the placeholder test intests/mail/navigate_spec.luato load it, callnav.goto_reply(), and assert the cursor lands on a line matching^>.Replaces the earlier PR #16 which was auto-marked merged after a branch-pointer mishap during the parallel-agent rollout. This PR contains the actual code changes.
All navigate tests pass (Failed: 0).