Skip to content

Commit 9514ed4

Browse files
committed
test: cover gate lookup failure at handoff
1 parent 046c456 commit 9514ed4

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

‎src/services/__tests__/pr-review-state-workflow.test.ts‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,6 +1180,27 @@ describe("PR review-state workflow", () => {
11801180
expect(result.addLabels).toHaveBeenCalledWith(expect.objectContaining({ labels: ["coderabbit-review-active"] }))
11811181
})
11821182

1183+
it("does not publish success when gate status lookup fails at the maintainer handoff", async () => {
1184+
const result = await runWorkflow({
1185+
gateStatusLookupErrorStatus: 500,
1186+
reviews: [
1187+
{
1188+
login: "coderabbitai[bot]",
1189+
type: "Bot",
1190+
state: "APPROVED",
1191+
submittedAt: REVIEWED_AT,
1192+
},
1193+
],
1194+
})
1195+
1196+
expect(result.setFailed).not.toHaveBeenCalled()
1197+
expect(result.warning).toHaveBeenCalledWith(
1198+
expect.stringContaining("could not inspect Zoo Code / PR review gate"),
1199+
)
1200+
expect(result.createCommitStatus).not.toHaveBeenCalledWith(expect.objectContaining({ state: "success" }))
1201+
expect(result.addLabels).toHaveBeenCalledWith(expect.objectContaining({ labels: ["awaiting-maintainer"] }))
1202+
})
1203+
11831204
it("forces gate invalidation after a reconciliation failure even when status lookup fails", async () => {
11841205
const result = await runWorkflow({
11851206
gateStatusLookupErrorStatus: 500,

0 commit comments

Comments
 (0)