Skip to content

test(render): add unit tests for CodeHandlerImpl - #1536

Open
sabhi128 wants to merge 1 commit into
OpenCSGs:mainfrom
sabhi128:feat-code-handler-tests
Open

test(render): add unit tests for CodeHandlerImpl#1536
sabhi128 wants to merge 1 commit into
OpenCSGs:mainfrom
sabhi128:feat-code-handler-tests

Conversation

@sabhi128

Copy link
Copy Markdown
Contributor

Summary of Changes

This PR expands backend test coverage by adding unit tests for CodeHandlerImpl under internal/handlers/render/.

Changes:

  • New File: internal/handlers/render/codes_test.go
    • Added route rendering coverage for:
      1. List route (codes_index template rendering).
      2. Detail route (parameter mapping of namespace and code_name to codes_show template).
      3. New route (checks context layout and license dictionary injection matching DefaultLicensesJSON).

All rendering calls are tested in isolation using Mockery's testifying mocks.

Copilot AI lite review requested due to automatic review settings August 28, 2026 11:21

Copilot AI 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.

Pull request overview

This PR increases backend test coverage for the render-layer CodeHandlerImpl by adding unit tests that verify the expected template names and key data mappings passed to the rendering layer.

Changes:

  • Add unit tests for CodeHandlerImpl.List, CodeHandlerImpl.Detail, and CodeHandlerImpl.New.
  • Validate route param mapping for namespace and code_name into the render data (codeName) for the detail view.
  • Validate that the licenses value passed to the “new” template matches DefaultLicensesJSON.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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