From 9298467eced33fefb649eb7ffb61a4b0a75bdee0 Mon Sep 17 00:00:00 2001 From: Lex Christopherson Date: Fri, 13 Mar 2026 23:37:52 -0600 Subject: [PATCH] fix: update integration branch test to match #300 behavior MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit writeIntegrationBranch now intentionally updates when the branch changes (#300). Updated the stale "idempotent — doesn't overwrite" test to assert the new behavior, and added a separate test for same-branch idempotency. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../extensions/gsd/tests/git-service.test.ts | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/resources/extensions/gsd/tests/git-service.test.ts b/src/resources/extensions/gsd/tests/git-service.test.ts index a08b29844..fbcbf1f34 100644 --- a/src/resources/extensions/gsd/tests/git-service.test.ts +++ b/src/resources/extensions/gsd/tests/git-service.test.ts @@ -1429,17 +1429,32 @@ async function main(): Promise { rmSync(repo, { recursive: true, force: true }); } - // ─── writeIntegrationBranch: idempotent — doesn't overwrite ─────────── + // ─── writeIntegrationBranch: updates when branch changes (#300) ────── - console.log("\n=== Integration branch: idempotent write ==="); + console.log("\n=== Integration branch: updates on branch change ==="); { const repo = initBranchTestRepo(); writeIntegrationBranch(repo, "M001", "f-123-first"); - writeIntegrationBranch(repo, "M001", "f-456-second"); // should NOT overwrite + writeIntegrationBranch(repo, "M001", "f-456-second"); // updates to new branch (#300) - assertEq(readIntegrationBranch(repo, "M001"), "f-123-first", "second write does not overwrite existing integration branch"); + assertEq(readIntegrationBranch(repo, "M001"), "f-456-second", "second write updates integration branch to new value"); + + rmSync(repo, { recursive: true, force: true }); + } + + // ─── writeIntegrationBranch: same branch is idempotent ───────────────── + + console.log("\n=== Integration branch: same branch is idempotent ==="); + + { + const repo = initBranchTestRepo(); + + writeIntegrationBranch(repo, "M001", "f-123-first"); + writeIntegrationBranch(repo, "M001", "f-123-first"); // same branch — no-op + + assertEq(readIntegrationBranch(repo, "M001"), "f-123-first", "same branch write is idempotent"); rmSync(repo, { recursive: true, force: true }); }