Skip to content

chore: api tests#105

Merged
martian56 merged 33 commits intomainfrom
103-chore-api-tests
May 7, 2026
Merged

chore: api tests#105
martian56 merged 33 commits intomainfrom
103-chore-api-tests

Conversation

@martian56
Copy link
Copy Markdown
Member

@martian56 martian56 commented May 7, 2026

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.mod file to add and upgrade dependencies required for testing and related features.

Key changes:

Test coverage for HTTP handlers

  • Added a new test suite for authentication endpoints, including sign-up, sign-in, password management, notification preferences, API tokens, and magic code flows in api/internal/handler/auth_test.go.
  • Introduced tests for comment CRUD operations and reactions in api/internal/handler/comment_test.go.
  • Added tests for cycle (sprint) CRUD operations and issue association in api/internal/handler/cycle_test.go.
  • Implemented tests for favoriting projects in api/internal/handler/favorite_test.go.
  • Created a placeholder for general handler tests in api/internal/handler/handler_test.go.

Dependency management

  • Updated api/go.mod to add testing libraries such as testcontainers, testify, and related dependencies, and upgraded several indirect dependencies for compatibility and feature support [1] [2].

martian56 added 30 commits May 7, 2026 12:52
@martian56 martian56 added this to the Deadline milestone May 7, 2026
@martian56 martian56 self-assigned this May 7, 2026
Copilot AI review requested due to automatic review settings May 7, 2026 08:57
@martian56 martian56 added documentation Improvements or additions to documentation enhancement New feature or request labels May 7, 2026
@martian56 martian56 linked an issue May 7, 2026 that may be closed by this pull request
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/testutil infrastructure: 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.sum to include testcontainers-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.

Comment thread api/internal/testutil/auth.go Outdated
Comment thread api/internal/testutil/router.go
Comment thread api/internal/handler/project_test.go Outdated
Comment thread api/internal/handler/comment_test.go Outdated
Comment thread api/go.mod
@martian56 martian56 merged commit b9b404c into main May 7, 2026
7 checks passed
@martian56 martian56 deleted the 103-chore-api-tests branch May 7, 2026 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Contribution documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CHORE] API tests

3 participants