Skip to content

Commit 716c6c8

Browse files
korthoutclaude
andcommitted
test: tighten progressive-update assertions to count markers
The all-pending and partial state checks used substring presence, which would also accept states with one pending plus one failed or skipped row. The current setup only ever produces successes and pendings so the looser checks happened to be equivalent in practice — but readers couldn't tell that without inspecting which statuses the orchestrator can emit. Count hourglass and checkmark markers explicitly: the all-pending state has exactly two hourglasses and zero checkmarks, the partial state has exactly one of each. The contract is now visible at the assertion site without requiring the reader to reason about which other statuses might appear. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent a5c7207 commit 716c6c8

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

src/test/backport.integration.test.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -715,19 +715,22 @@ describe("Backport.run() orchestration", () => {
715715
const backport = new Backport(github, config, git);
716716
await backport.run();
717717

718-
// Find the targets-known update (all pending, no completed rows)
718+
const countMatches = (body: string, marker: string) =>
719+
(body.match(new RegExp(marker, "g")) ?? []).length;
720+
721+
// Targets-known update: both rows pending, no completed rows
719722
const allPending = github.updatedComments.find(
720723
(u) =>
721-
u.body.includes(":hourglass:") &&
724+
countMatches(u.body, ":hourglass:") === 2 &&
722725
!u.body.includes(":white_check_mark:"),
723726
);
724727
expect(allPending).toBeDefined();
725728

726-
// Find partial update (one completed, one pending)
729+
// Partial update: exactly one completed, exactly one pending
727730
const partial = github.updatedComments.find(
728731
(u) =>
729-
u.body.includes(":white_check_mark:") &&
730-
u.body.includes(":hourglass:"),
732+
countMatches(u.body, ":white_check_mark:") === 1 &&
733+
countMatches(u.body, ":hourglass:") === 1,
731734
);
732735
expect(partial).toBeDefined();
733736

0 commit comments

Comments
 (0)