test: add unit tests for POST /issues create issue handler covering success, validation errors, and HTMX redirect #197
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?
Summary
The
CreateIssuehandler (POST /issues) ininternal/handlers/handlers.gohas no unit or integration test coverage. The integration test suite covers the GET routes but the create issue POST path is untested.What to do
Add tests in
internal/handlers/integration_test.go(orhandlers_test.go) covering:owner_repo,title,body,label_idsfields returns HTTP 303 redirect to the new issue URL (or an HTMX swap response ifHX-Request: true)owner_repovalue returns HTTP 400HX-Request: trueheader returns an HTMX-compatible response (e.g.HX-Redirectheader or HTML fragment) rather than a full HTTP redirect/settingsAcceptance Criteria
go test ./internal/handlers/...go vet ./...passes after changesReferences
internal/handlers/handlers.go—CreateIssuefunc at line ~726internal/handlers/integration_test.go— existing test patternsPOST /issuesrouteClosing as duplicate of #179 which already covers
POST /issuestest cases including success, validation, and HTMX response paths. See #179 item 1 and 6.