Skip to content

test: add route-level coverage for POST /api/update/sync-fork - #6102

Merged
atomantic merged 1 commit into
atomantic:mainfrom
Bryandero98:fix/sync-fork-route-tests
Sep 3, 2026
Merged

test: add route-level coverage for POST /api/update/sync-fork#6102
atomantic merged 1 commit into
atomantic:mainfrom
Bryandero98:fix/sync-fork-route-tests

Conversation

@Bryandero98

Copy link
Copy Markdown
Contributor

Summary

  • Fixes Add route-level test coverage for POST /api/update/sync-fork preflight gates, 409 FORK_DIVERGED translation, and 502 failures #6039
  • server/routes/update.test.js had zero tests for POST /api/update/sync-fork despite the route implementing 7 distinct structured error codes plus a success path — no automated guard against regressions in schema validation, status codes, or error mapping.
  • Added the 9 cases from the issue's own Fix section:
    1. 200 with sync result, default branch
    2. 200 with sync result, custom branch
    3. 400 NO_ORIGIN
    4. 400 NOT_GITHUB
    5. 400 ALREADY_UPSTREAM
    6. 400 NOT_A_FORK
    7. 502 GIT_UNAVAILABLE (when getRemoteInfo rejects)
    8. 409 FORK_DIVERGED (when syncFork reports a non-fast-forward, asserting the recovery guidance text is present in the error message)
    9. 502 FORK_SYNC_FAILED (an unrelated syncFork error)
    10. 400 schema rejection on a branch name with disallowed characters
  • No production code changed — test-only.

Test plan

  • cd server && npx vitest run routes/update.test.js → 34/34 passed (25 existing + 9 new).

🤖 Generated with Claude Code

…tic#6039)

server/routes/update.test.js had zero tests for /api/update/sync-fork
despite the route implementing 7 distinct error codes plus success —
regressions in schema validation, status codes, or error mapping had
no automated guard.

Added the 9 cases from the issue's Fix section: success with default
and custom branch, all 4 pre-flight 400s (NO_ORIGIN, NOT_GITHUB,
ALREADY_UPSTREAM, NOT_A_FORK), 502 GIT_UNAVAILABLE, 409 FORK_DIVERGED
(asserting the recovery guidance in the message), 502
FORK_SYNC_FAILED, and a schema rejection on an invalid branch name.
No production code changed.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@atomantic
atomantic merged commit ff4440e into atomantic:main Sep 3, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add route-level test coverage for POST /api/update/sync-fork preflight gates, 409 FORK_DIVERGED translation, and 502 failures

2 participants