Skip to content

Implement End-to-End Deployment Pipeline Integration Test with GitHub API Mock Injection #795

Description

@temma02

Description

There is no integration test that exercises the full deployment route handler through to the GitHub repository creation step. Add an integration test using msw (Mock Service Worker) to intercept GitHub API calls and simulate the full deployment initiation flow from HTTP request to Supabase record creation.

Requirements and Context

  • Mock GitHub REST API endpoints: POST /user/repos, POST /repos/{owner}/{repo}/git/refs
  • Assert the deployments Supabase table is updated with correct initial state
  • Test error path: GitHub 403 (repository limit reached) propagates as 402 to the client
  • Integration test must use a real Next.js request handler, not mocked at function level

Suggested Execution

Branch: test/deployment-pipeline-github-integration

Implement Changes

  • Add deployment-pipeline.github.integration.test.ts in apps/backend/src/app/api/deployments/
  • Set up msw server with GitHub API handlers
  • Assert deployment record in mocked Supabase reflects pending→generating→creating_repo transitions
  • Test GitHub 403 maps to { error: 'REPOSITORY_LIMIT_REACHED', status: 402 }

Test and Commit

Run pnpm test -- deployment-pipeline.github.integration and confirm all API interaction assertions pass.

Example Commit Message

test(integration): add E2E deployment pipeline test with GitHub API mock injection

Co-authored-by: <your-name>

Guidelines

  • Branch off main, keep PRs focused on one issue
  • All new code must include unit or integration tests
  • Ensure pnpm lint and pnpm typecheck pass before review
  • Link this issue in your PR description
  • Request review from at least one maintainer before merging

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programintegrationIntegration testing issuestestingTesting related issues

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions