From 9bf3ea9b56787fbb348ff0fca40103b8401f671d Mon Sep 17 00:00:00 2001 From: "hivecommons-hive[bot]" Date: Mon, 28 Sep 2026 23:35:13 -0400 Subject: [PATCH] test(plugins): cover the non-Error rejection arm of the requireMatchingLabel rule report Signed-off-by: quality --- __tests__/plugins/requireMatchingLabel.test.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/__tests__/plugins/requireMatchingLabel.test.ts b/__tests__/plugins/requireMatchingLabel.test.ts index 701c9214..16fe1e02 100644 --- a/__tests__/plugins/requireMatchingLabel.test.ts +++ b/__tests__/plugins/requireMatchingLabel.test.ts @@ -9,6 +9,7 @@ import { handleIssueComment } from '../../src/issueComment/handleIssueComment' import { handleIssues } from '../../src/issues/handleIssues' import { applicableRules, checkRequiredLabels, evaluate, maxGracePeriodMs, parseDuration, requireMatchingLabel } from '../../src/plugins/requireMatchingLabel' import { handlePullReq } from '../../src/pullReq/handlePullReq' +import * as labeling from '../../src/utils/labeling' import * as sleepModule from '../../src/utils/sleep' import issueCommentEvent from '../fixtures/issues/issueCommentEvent.json' import issuesLabeledEvent from '../fixtures/issues/issuesLabeledEvent.json' @@ -403,6 +404,16 @@ describe('requireMatchingLabel handler', () => { expect(await writes.addLabels.body()).toEqual({ labels: ['needs-area'] }) }) + it('reports a non-Error rejection from a rule verbatim', async () => { + serveRules([kindRule]) + serveIssue([]) + vi.spyOn(labeling, 'labelIssue').mockRejectedValueOnce('rate limited') + + await expect(requireMatchingLabel(new utils.MockContext(issueEvent('opened', [])))).rejects.toThrow( + 'require-matching-label needs-kind: rate limited', + ) + }) + it('is registered on the issues event', async () => { serveRules([kindRule]) const writes = serveIssue(['kind/bug', 'needs-kind'], [botComment])