Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions __tests__/plugins/requireMatchingLabel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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])
Expand Down
Loading