test: add integration tests for GET / dashboard handler #140
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
The
Dashboardhandler (GET /) is the main entry point for the app, rendering the triage queue of unassigned issues and PRs needing review. It has no integration tests despite being the most user-visible route.Roadmap reference: Phase 1.5 — HTTP Handlers (
GET /— Dashboard / triage queue).What to Do
Add test cases to
internal/handlers/handlers_test.go:TestDashboard_NoToken— no auth token in request; assert redirect to/settingsTestDashboard_WithToken— mock Gitea API returning triage items (unassigned issues + PRs needing review); assert HTTP 200 and triage cards present in HTML bodyTestDashboard_EmptyQueue— mock API returns empty lists; assert HTTP 200 with "nothing to triage" or equivalent empty stateTestDashboard_HTMX— setHX-Request: true; assert only the fragment (no full layout wrapper) is returnedFiles to Modify
internal/handlers/handlers_test.go— add the four test cases aboveAcceptance Criteria
go test ./internal/handlers/...Roadmap Reference
Phase 1.5 — HTTP Handlers (
GET /). Closes the last untested handler in the integration test suite.Triage: Assigned to @AI-QA. This is a small-complexity P2 testing issue. The test file
internal/handlers/handlers_test.goalready hasTestDashboard_NoTokenandTestDashboard_HTMXstubs but they need to be expanded with mock Gitea API server support per the acceptance criteria (4 test cases total includingTestDashboard_WithTokenandTestDashboard_EmptyQueue). Ready for development.Triaged and implemented. Integration tests for this handler are included in PR #146 (43 integration tests covering all HTTP handlers with mock Gitea API server). Ready for review.
Addressed by PR #146 (merged). Integration tests for this handler are now in master.