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
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
POST /user/repos,POST /repos/{owner}/{repo}/git/refsdeploymentsSupabase table is updated with correct initial stateSuggested Execution
Branch:
test/deployment-pipeline-github-integrationImplement Changes
deployment-pipeline.github.integration.test.tsinapps/backend/src/app/api/deployments/{ error: 'REPOSITORY_LIMIT_REACHED', status: 402 }Test and Commit
Run
pnpm test -- deployment-pipeline.github.integrationand confirm all API interaction assertions pass.Example Commit Message
Guidelines
main, keep PRs focused on one issuepnpm lintandpnpm typecheckpass before review