fix: update integration branch test to match #300 behavior
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) <noreply@anthropic.com>
This commit is contained in:
parent
ff1d7c5af9
commit
9298467ece
1 changed files with 19 additions and 4 deletions
|
|
@ -1429,17 +1429,32 @@ async function main(): Promise<void> {
|
|||
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 });
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue