Skip to content

Commit 549ec85

Browse files
t3dotggclaude
andcommitted
test(server): trim push rejection tests to one case per reason
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 66e849d commit 549ec85

1 file changed

Lines changed: 9 additions & 50 deletions

File tree

‎apps/server/src/vcs/GitVcsDriverCore.test.ts‎

Lines changed: 9 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -862,17 +862,6 @@ describe("rejected git refs", () => {
862862
`To ${remoteUrl}`,
863863
" ! [rejected] private-branch -> private-branch (non-fast-forward)",
864864
failedPush,
865-
"hint: Updates were rejected because the tip of your current branch is behind",
866-
],
867-
reason: "push_rejected_non_fast_forward" as const,
868-
detail: "Pull or rebase",
869-
},
870-
{
871-
label: "a push that needs a fetch first",
872-
stderr: [
873-
`To ${remoteUrl}`,
874-
" ! [rejected] private-branch -> private-branch (fetch first)",
875-
failedPush,
876865
],
877866
reason: "push_rejected_non_fast_forward" as const,
878867
detail: "Pull or rebase",
@@ -883,51 +872,21 @@ describe("rejected git refs", () => {
883872

884873
assert.deepInclude(error, { reason });
885874
assert.include(error.detail, detail);
886-
assert.include(error.message, `(${reason})`);
887875
for (const text of leakedText) assert.notInclude(error.message, text);
888876
}),
889877
);
890878

891-
it.effect.each([
892-
{
893-
label: "a tag a fetch would clobber",
894-
stderr: [
895-
`From ${remoteUrl}`,
896-
" ! [rejected] v1 -> v1 (would clobber existing tag)",
897-
],
898-
reason: "tag_would_be_clobbered" as const,
899-
},
900-
{
901-
label: "a tag that already exists on the remote",
902-
stderr: [
903-
`To ${remoteUrl}`,
904-
" ! [rejected] v1 -> v1 (already exists)",
905-
failedPush,
906-
"hint: Updates were rejected because the tag already exists in the remote.",
907-
],
908-
reason: undefined,
909-
},
910-
{
911-
// Only push ends with "failed to push some refs"; a fetch into a local
912-
// branch prints the same rejected line.
913-
label: "a fetch into a diverged local branch",
914-
stderr: [`From ${remoteUrl}`, " ! [rejected] main -> side (non-fast-forward)"],
915-
reason: undefined,
916-
},
917-
{
918-
label: "rejection lines echoed behind the remote prefix",
919-
stderr: [
920-
"remote: ! [remote rejected] private-branch -> private-branch (declined)",
921-
"remote: ! [rejected] private-branch -> private-branch (non-fast-forward)",
922-
failedPush,
923-
],
924-
reason: undefined,
925-
},
926-
])("leaves $label as it was", ({ stderr, reason }) =>
879+
// A fetch into a diverged local branch prints the same rejected line, but
880+
// never "failed to push some refs".
881+
it.effect("leaves a rejected fetch unclassified", () =>
927882
Effect.gen(function* () {
928-
const error = yield* failWith(stderr.join("\n"));
883+
const error = yield* failWith(
884+
[`From ${remoteUrl}`, " ! [rejected] main -> side (non-fast-forward)"].join(
885+
"\n",
886+
),
887+
);
929888

930-
assert.equal(error.reason, reason);
889+
assert.equal(error.reason, undefined);
931890
assert.equal(error.detail, "Git command exited with a non-zero status.");
932891
}),
933892
);

0 commit comments

Comments
 (0)