test: add route-level coverage for POST /api/update/sync-fork - #6102
Merged
Conversation
…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>
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.
Summary
server/routes/update.test.jshad zero tests forPOST /api/update/sync-forkdespite 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.NO_ORIGINNOT_GITHUBALREADY_UPSTREAMNOT_A_FORKGIT_UNAVAILABLE(whengetRemoteInforejects)FORK_DIVERGED(whensyncForkreports a non-fast-forward, asserting the recovery guidance text is present in the error message)FORK_SYNC_FAILED(an unrelatedsyncForkerror)Test plan
cd server && npx vitest run routes/update.test.js→ 34/34 passed (25 existing + 9 new).🤖 Generated with Claude Code