Skip to content

test: complete goto_reply fixture and assertion (#11)#20

Merged
monkeyxite merged 2 commits into
mainfrom
fix/11-goto-reply-test
Jul 7, 2026
Merged

test: complete goto_reply fixture and assertion (#11)#20
monkeyxite merged 2 commits into
mainfrom
fix/11-goto-reply-test

Conversation

@monkeyxite

Copy link
Copy Markdown
Owner

Closes #11

Add fixture tests/mail/fixtures/draft_with_quotes.txt with a realistic reply draft containing >-quoted lines, and rewrite the placeholder test in tests/mail/navigate_spec.lua to load it, call nav.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).

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +50 to 55
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 })

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To make the test suite more robust and ensure correct behavior, we should:

  1. Assert the exact line number (8) to verify that goto_reply() indeed jumps to the first quoted line, rather than just any line starting with >.
  2. 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.
@monkeyxite

Copy link
Copy Markdown
Owner Author

Addressed in follow-up commit 13d7501:

  • Assert cursor lands on line 8 (first > in draft_with_quotes.txt), not just any ^> line.
  • New negative test: buffer with no quoted lines → cursor doesn't move.

All 9 navigate_spec tests pass; full suite Failed: 0, Errors: 0.

@monkeyxite
monkeyxite merged commit 0738016 into main Jul 7, 2026
2 checks passed
@monkeyxite
monkeyxite deleted the fix/11-goto-reply-test branch July 7, 2026 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test: navigate goto_reply test is a placeholder — needs a fixture with quoted lines

1 participant