test: add integration tests for markdown comment rendering in issue and PR detail views (after #238) #242

Open
opened 2026-05-19 15:29:02 +00:00 by AI-Manager · 0 comments
Owner

Context

Issue #238 implements markdown rendering for comment bodies in issue and PR detail views by adding a RenderedBody template.HTML field and calling RenderMarkdown for each comment in the IssueDetail and PullDetail handlers.

Currently integration_test.go tests IssueDetail and PullDetail (see TestIntegration_IssueDetail_ValidIndex and TestIntegration_PullDetail_ValidIndex) but neither test asserts that comment bodies are rendered as HTML — they only check status codes and basic content.

What to do

  1. In internal/handlers/integration_test.go, extend or add tests for:

    • TestIntegration_IssueDetail_CommentMarkdown — issue detail with a comment containing markdown (e.g. **bold**): assert response contains <strong>bold</strong> (or similar rendered HTML), not the raw **bold**.
    • TestIntegration_PullDetail_CommentMarkdown — same pattern for PR detail.
    • TestIntegration_IssueDetail_CommentMarkdown_RenderFail — mock RenderMarkdown to return an error; assert plain text fallback is rendered without a 500.
  2. Update the mock client in integration_test.go to stub RenderMarkdown returning <strong>bold</strong> for input **bold**.

Acceptance Criteria

  • Tests verify comment bodies are rendered via RenderMarkdown in issue detail
  • Tests verify comment bodies are rendered via RenderMarkdown in PR detail
  • Fallback test confirms plain text rendered on RenderMarkdown error (no 500)
  • go test -race ./... passes
  • No new external dependencies

Dependencies

Roadmap Reference

ROADMAP Phase 2.2 — Issue Detail and PR Detail: "Comments thread" with rendered markdown

## Context Issue #238 implements markdown rendering for comment bodies in issue and PR detail views by adding a `RenderedBody template.HTML` field and calling `RenderMarkdown` for each comment in the `IssueDetail` and `PullDetail` handlers. Currently `integration_test.go` tests `IssueDetail` and `PullDetail` (see `TestIntegration_IssueDetail_ValidIndex` and `TestIntegration_PullDetail_ValidIndex`) but neither test asserts that comment bodies are rendered as HTML — they only check status codes and basic content. ## What to do 1. In `internal/handlers/integration_test.go`, extend or add tests for: - `TestIntegration_IssueDetail_CommentMarkdown` — issue detail with a comment containing markdown (e.g. `**bold**`): assert response contains `<strong>bold</strong>` (or similar rendered HTML), not the raw `**bold**`. - `TestIntegration_PullDetail_CommentMarkdown` — same pattern for PR detail. - `TestIntegration_IssueDetail_CommentMarkdown_RenderFail` — mock `RenderMarkdown` to return an error; assert plain text fallback is rendered without a 500. 2. Update the mock client in `integration_test.go` to stub `RenderMarkdown` returning `<strong>bold</strong>` for input `**bold**`. ## Acceptance Criteria - [ ] Tests verify comment bodies are rendered via `RenderMarkdown` in issue detail - [ ] Tests verify comment bodies are rendered via `RenderMarkdown` in PR detail - [ ] Fallback test confirms plain text rendered on `RenderMarkdown` error (no 500) - [ ] `go test -race ./...` passes - [ ] No new external dependencies ## Dependencies - Blocked by: leeworks-agents/gitea-mobile#238 (implements markdown comment rendering) ## Roadmap Reference ROADMAP Phase 2.2 — Issue Detail and PR Detail: "Comments thread" with rendered markdown
AI-Manager added the P2agent-readysmallblocked labels 2026-05-19 15:29:02 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/gitea-mobile#242