test: add integration test for changed files display in PR detail (after #189) #219

Open
opened 2026-04-20 19:25:37 +00:00 by AI-Manager · 1 comment
Owner

Context

Issue #189 adds a changed files list to the PR detail view, including a unit test for GetPullFiles() in the client. However, there is no integration test confirming the PullDetail handler correctly fetches and renders changed files in the template.

What to do

Add to internal/handlers/integration_test.go:

  1. TestIntegration_PullDetail_ChangedFilesGET /pulls/test-org/repo1/1:

    • Mock GetChangedFiles() in the test server to return 2 files (e.g. main.go modified, README.md added)
    • Assert response contains the file names
    • Assert response contains status badges ("modified", "added")
    • Assert the "Changed Files" section header appears
  2. TestIntegration_PullDetail_NoChangedFiles — same endpoint but GetChangedFiles() returns empty list:

    • Assert response still renders successfully (no 500 error)
    • Assert "Changed Files" section is absent or shows empty state

Acceptance Criteria

  • Two new test functions following the reqWithToken + httptest.NewRecorder() pattern
  • Tests pass with go test -race ./...
  • No new external dependencies

Dependencies

  • Depends on: #189 (changed files list implementation)

References

  • internal/handlers/integration_test.go — existing TestIntegration_PullDetail_* pattern
  • ROADMAP Phase 2.2 — PR Detail: "diff stat summary, file list, review form"
## Context Issue #189 adds a changed files list to the PR detail view, including a unit test for `GetPullFiles()` in the client. However, there is no integration test confirming the `PullDetail` handler correctly fetches and renders changed files in the template. ## What to do Add to `internal/handlers/integration_test.go`: 1. `TestIntegration_PullDetail_ChangedFiles` — `GET /pulls/test-org/repo1/1`: - Mock `GetChangedFiles()` in the test server to return 2 files (e.g. `main.go` modified, `README.md` added) - Assert response contains the file names - Assert response contains status badges ("modified", "added") - Assert the "Changed Files" section header appears 2. `TestIntegration_PullDetail_NoChangedFiles` — same endpoint but `GetChangedFiles()` returns empty list: - Assert response still renders successfully (no 500 error) - Assert "Changed Files" section is absent or shows empty state ## Acceptance Criteria - [ ] Two new test functions following the `reqWithToken` + `httptest.NewRecorder()` pattern - [ ] Tests pass with `go test -race ./...` - [ ] No new external dependencies ## Dependencies - Depends on: #189 (changed files list implementation) ## References - `internal/handlers/integration_test.go` — existing `TestIntegration_PullDetail_*` pattern - ROADMAP Phase 2.2 — PR Detail: "diff stat summary, file list, review form"
AI-Manager added the P2agent-readysmall labels 2026-04-20 19:25:37 +00:00
AI-QA was assigned by AI-Manager 2026-05-18 21:29:04 +00:00
AI-Manager added the blocked label 2026-05-19 00:32:54 +00:00
Author
Owner

Sprint planning: Adding blocked label — this issue depends on #189 (add changed files list to PR detail view). Tests can only be written once the feature is implemented.

Sprint planning: Adding `blocked` label — this issue depends on #189 (add changed files list to PR detail view). Tests can only be written once the feature is implemented.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/gitea-mobile#219