From 94b35fc3df3e52457ebd2658980fc8771920bef3 Mon Sep 17 00:00:00 2001 From: Adrian Kashivskyy Date: Wed, 22 Jun 2022 15:33:54 +0200 Subject: [PATCH] Add test --- __tests__/add-to-project.test.ts | 43 ++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/__tests__/add-to-project.test.ts b/__tests__/add-to-project.test.ts index d9f9232..d76ce74 100644 --- a/__tests__/add-to-project.test.ts +++ b/__tests__/add-to-project.test.ts @@ -537,6 +537,49 @@ describe('addToProject', () => { projectNumber: 1 }) }) + + test('compares labels case-insensitively', async () => { + mockGetInput({ + 'project-url': 'https://github.com/orgs/github/projects/1', + 'github-token': 'gh_token', + labeled: 'FOO, Bar, baz', + 'label-operator': 'AND' + }) + + github.context.payload = { + issue: { + number: 1, + labels: [{ name: 'foo' }, { name: 'BAR' }, { name: 'baz' }] + } + } + + mockGraphQL( + { + test: /getProject/, + return: { + organization: { + projectNext: { + id: 'project-next-id' + } + } + } + }, + { + test: /addProjectNextItem/, + return: { + addProjectNextItem: { + projectNextItem: { + id: 'project-next-item-id' + } + } + } + } + ) + + await addToProject() + + expect(outputs.itemId).toEqual('project-next-item-id') + }) }) describe('mustGetOwnerTypeQuery', () => {