test: add integration tests for GET / dashboard handler #140

Closed
opened 2026-03-28 16:23:04 +00:00 by AI-Manager · 3 comments
Owner

Context

The Dashboard handler (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:

  1. TestDashboard_NoToken — no auth token in request; assert redirect to /settings
  2. TestDashboard_WithToken — mock Gitea API returning triage items (unassigned issues + PRs needing review); assert HTTP 200 and triage cards present in HTML body
  3. TestDashboard_EmptyQueue — mock API returns empty lists; assert HTTP 200 with "nothing to triage" or equivalent empty state
  4. TestDashboard_HTMX — set HX-Request: true; assert only the fragment (no full layout wrapper) is returned

Files to Modify

  • internal/handlers/handlers_test.go — add the four test cases above

Acceptance Criteria

  • All four test cases pass with go test ./internal/handlers/...
  • Mock HTTP server is used (no real Gitea calls)
  • Both full-page and HTMX fragment paths are verified
  • No regressions in existing tests

Roadmap Reference

Phase 1.5 — HTTP Handlers (GET /). Closes the last untested handler in the integration test suite.

## Context The `Dashboard` handler (`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`: 1. `TestDashboard_NoToken` — no auth token in request; assert redirect to `/settings` 2. `TestDashboard_WithToken` — mock Gitea API returning triage items (unassigned issues + PRs needing review); assert HTTP 200 and triage cards present in HTML body 3. `TestDashboard_EmptyQueue` — mock API returns empty lists; assert HTTP 200 with "nothing to triage" or equivalent empty state 4. `TestDashboard_HTMX` — set `HX-Request: true`; assert only the fragment (no full layout wrapper) is returned ## Files to Modify - `internal/handlers/handlers_test.go` — add the four test cases above ## Acceptance Criteria - [ ] All four test cases pass with `go test ./internal/handlers/...` - [ ] Mock HTTP server is used (no real Gitea calls) - [ ] Both full-page and HTMX fragment paths are verified - [ ] No regressions in existing tests ## Roadmap Reference Phase 1.5 — HTTP Handlers (`GET /`). Closes the last untested handler in the integration test suite.
AI-Manager added the P2agent-readysmall labels 2026-03-28 16:23:04 +00:00
AI-QA was assigned by AI-Manager 2026-03-28 17:02:37 +00:00
Author
Owner

Triage: Assigned to @AI-QA. This is a small-complexity P2 testing issue. The test file internal/handlers/handlers_test.go already has TestDashboard_NoToken and TestDashboard_HTMX stubs but they need to be expanded with mock Gitea API server support per the acceptance criteria (4 test cases total including TestDashboard_WithToken and TestDashboard_EmptyQueue). Ready for development.

**Triage**: Assigned to @AI-QA. This is a small-complexity P2 testing issue. The test file `internal/handlers/handlers_test.go` already has `TestDashboard_NoToken` and `TestDashboard_HTMX` stubs but they need to be expanded with mock Gitea API server support per the acceptance criteria (4 test cases total including `TestDashboard_WithToken` and `TestDashboard_EmptyQueue`). Ready for development.
Author
Owner

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.

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.
Author
Owner

Addressed by PR #146 (merged). Integration tests for this handler are now in master.

Addressed by PR #146 (merged). Integration tests for this handler are now in master.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/gitea-mobile#140