mirror of
https://github.com/actions/add-to-project.git
synced 2025-12-11 12:37:16 +00:00
Add test case
This commit is contained in:
@@ -223,6 +223,28 @@ describe('addToProject', () => {
|
|||||||
expect(gqlMock).not.toHaveBeenCalled()
|
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 () => {
|
test('adds matching issues with multiple label filters', async () => {
|
||||||
mockGetInput({
|
mockGetInput({
|
||||||
'project-url': 'https://github.com/orgs/github/projects/1',
|
'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
|
description: A comma-separated list of labels to use as a filter for issue to be added
|
||||||
label-operator:
|
label-operator:
|
||||||
required: false
|
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:
|
runs:
|
||||||
using: 'node16'
|
using: 'node16'
|
||||||
main: 'dist/index.js'
|
main: 'dist/index.js'
|
||||||
|
|||||||
Reference in New Issue
Block a user