Skip to content

refactor(test): replace replicated render logic with real function calls#89

Merged
dlyongemallo merged 1 commit into
mainfrom
refactor_test_real_calls
Apr 8, 2026
Merged

refactor(test): replace replicated render logic with real function calls#89
dlyongemallo merged 1 commit into
mainfrom
refactor_test_real_calls

Conversation

@dlyongemallo
Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings April 8, 2026 02:32
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Refactors functional rendering specs to stop duplicating production rendering logic and instead exercise the real internal render helpers exposed via each render module’s _test table.

Changes:

  • panel_render_spec.lua: replaces replicated grouped-folder-count counting/rendering with calls to render_folder_count() and validates rendered output.
  • file_history_render_spec.lua: removes locally mirrored implementations of render_stat_bar / render_file_stats / date formatting and calls the real _test helpers/formatters.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
lua/diffview/tests/functional/panel_render_spec.lua Updates folder-count tests to invoke render_folder_count() instead of reimplementing grouped counting/rendering logic.
lua/diffview/tests/functional/file_history_render_spec.lua Switches file-history render tests to use render._test exports rather than duplicated local implementations/constants.
Comments suppressed due to low confidence (1)

lua/diffview/tests/functional/panel_render_spec.lua:227

  • Same issue here: flat:find("1") / flat:find("2") is too weak and can produce false positives. Prefer checking the segments by the git-status highlight groups (DiffviewStatusAdded / DiffviewStatusDeleted) and/or asserting the exact count+icon strings, so the test fails if ordering or status grouping regresses.
        local flat = comp:flat_text()
        -- Should contain both status groups.
        assert.truthy(flat:find("1"), "expected count for A status")
        assert.truthy(flat:find("2"), "expected count for D status")


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lua/diffview/tests/functional/file_history_render_spec.lua Outdated
Comment thread lua/diffview/tests/functional/panel_render_spec.lua Outdated
@dlyongemallo dlyongemallo force-pushed the refactor_test_real_calls branch from 58705f4 to a04e47f Compare April 8, 2026 03:11
@dlyongemallo dlyongemallo merged commit f81170e into main Apr 8, 2026
2 checks passed
@dlyongemallo dlyongemallo deleted the refactor_test_real_calls branch April 8, 2026 07:56
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.

2 participants