Conversation
…ve/snooze lifecycle
… legacy /api/v1 route
Closed
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds HTTP-level API handler test coverage across many core endpoints by introducing a shared test harness (Gin router + Postgres testcontainer) and a set of DB-backed factories for common fixtures.
Changes:
- Added
api/internal/testutilinfrastructure: shared Postgres testcontainer, table truncation, request helpers, auth/session helpers, and model factories. - Added a broad suite of handler tests covering auth, workspaces, projects, issues, comments/reactions, cycles, pages, modules, labels, views, notifications, integrations/webhooks, uploads, and basic health/readiness routes.
- Updated
api/go.mod/api/go.sumto includetestcontainers-go,testify, and supporting dependency updates.
Reviewed changes
Copilot reviewed 31 out of 32 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| api/internal/testutil/truncate.go | Adds Postgres-based “truncate all tables” helper for per-test DB cleanup. |
| api/internal/testutil/router.go | Adds TestServer harness wiring Gin router + shared DB. |
| api/internal/testutil/pg.go | Starts and migrates a shared Postgres testcontainer (sync.Once). |
| api/internal/testutil/http.go | Adds HTTP request helpers and JSON decode helpers for handler tests. |
| api/internal/testutil/factory.go | Adds factories for users/workspaces/projects/issues/etc. |
| api/internal/testutil/auth.go | Adds session creation helper for authenticated handler tests. |
| api/internal/handler/handler_test.go | Adds placeholder file documenting test layout. |
| api/internal/handler/health_test.go | Adds tests for /health, /ready, and unknown route 404. |
| api/internal/handler/auth_test.go | Adds comprehensive auth/user endpoints test coverage. |
| api/internal/handler/comment_test.go | Adds comment CRUD and reaction tests. |
| api/internal/handler/cycle_test.go | Adds cycle CRUD and issue association tests. |
| api/internal/handler/favorite_test.go | Adds favorite projects list tests. |
| api/internal/handler/instance_test.go | Adds instance setup + settings endpoint tests. |
| api/internal/handler/integration_test.go | Adds integration endpoints/auth-gating tests (incl. legacy v1). |
| api/internal/handler/invitation_test.go | Adds invitation-by-token and public decline tests. |
| api/internal/handler/issue_test.go | Adds issue CRUD + assignees/activities/subscription tests. |
| api/internal/handler/label_test.go | Adds issue label CRUD tests. |
| api/internal/handler/module_test.go | Adds module CRUD + module-issues association tests. |
| api/internal/handler/notification_test.go | Adds notification list/count and lifecycle tests. |
| api/internal/handler/oauth_test.go | Adds OAuth provider routing/config tests. |
| api/internal/handler/page_test.go | Adds page CRUD + lock/archive/duplicate/version/favorite tests. |
| api/internal/handler/project_test.go | Adds project CRUD + members/invitations/favorite/draft issues tests. |
| api/internal/handler/quicklink_test.go | Adds quick-link CRUD tests. |
| api/internal/handler/recent_visit_test.go | Adds recent visits list + record tests. |
| api/internal/handler/state_test.go | Adds workflow state CRUD tests. |
| api/internal/handler/sticky_test.go | Adds sticky CRUD tests. |
| api/internal/handler/upload_test.go | Adds upload/files endpoints auth + “no minio” behavior tests. |
| api/internal/handler/view_test.go | Adds view CRUD + favorite route-variant tests. |
| api/internal/handler/webhook_test.go | Adds GitHub webhook signature/headers tests. |
| api/internal/handler/workspace_test.go | Adds workspace CRUD + members/invites/join/slug check tests. |
| api/go.mod | Adds/updates dependencies to support new test infrastructure. |
| api/go.sum | Updates checksums for added/updated dependencies. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
nazarli-shabnam
approved these changes
May 7, 2026
…hore-api-tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a comprehensive suite of HTTP handler tests for the API, covering authentication, comments, cycles, favorites, and basic handler setup. It also updates the
go.modfile to add and upgrade dependencies required for testing and related features.Key changes:
Test coverage for HTTP handlers
api/internal/handler/auth_test.go.api/internal/handler/comment_test.go.api/internal/handler/cycle_test.go.api/internal/handler/favorite_test.go.api/internal/handler/handler_test.go.Dependency management
api/go.modto add testing libraries such astestcontainers,testify, and related dependencies, and upgraded several indirect dependencies for compatibility and feature support [1] [2].