mirror of
https://github.com/actions/add-to-project.git
synced 2025-12-10 12:07:05 +00:00
Add test case
This commit is contained in:
@@ -223,6 +223,28 @@ describe('addToProject', () => {
|
||||
expect(gqlMock).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
test('does not add matching issues with labels filter with NOT label-operator', async () => {
|
||||
mockGetInput({
|
||||
'project-url': 'https://github.com/orgs/github/projects/1',
|
||||
'github-token': 'gh_token',
|
||||
labeled: 'bug, new',
|
||||
'label-operator': 'NOT'
|
||||
})
|
||||
|
||||
github.context.payload = {
|
||||
issue: {
|
||||
number: 1,
|
||||
labels: [{name: 'bug'}]
|
||||
}
|
||||
}
|
||||
|
||||
const infoSpy = jest.spyOn(core, 'info')
|
||||
const gqlMock = mockGraphQL()
|
||||
await addToProject()
|
||||
expect(infoSpy).toHaveBeenCalledWith(`Skipping issue 1 because it contains one of the labels: bug, new`)
|
||||
expect(gqlMock).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
test('adds matching issues with multiple label filters', async () => {
|
||||
mockGetInput({
|
||||
'project-url': 'https://github.com/orgs/github/projects/1',
|
||||
|
||||
@@ -15,7 +15,7 @@ inputs:
|
||||
description: A comma-separated list of labels to use as a filter for issue to be added
|
||||
label-operator:
|
||||
required: false
|
||||
description: The behavior of the labels filter, AND to match all labels, OR to match any label (default is OR)
|
||||
description: The behavior of the labels filter, AND to match all labels, OR to match any label, NOT to exclude any listed label (default is OR)
|
||||
runs:
|
||||
using: 'node16'
|
||||
main: 'dist/index.js'
|
||||
|
||||
Reference in New Issue
Block a user