From 1f18f04da1e7985e9f637401460b8c03ac549f59 Mon Sep 17 00:00:00 2001 From: Katie Borley Date: Fri, 29 Sep 2023 09:16:33 -0700 Subject: [PATCH] fix: combine tests and simplify priority label logic --- dist/146.index.js | 25 ++++---------- dist/146.index.js.map | 2 +- src/helpers/comment-issue-due-date.ts | 32 +++++++---------- test/helpers/comment-issue-due-date.test.ts | 38 ++++----------------- 4 files changed, 27 insertions(+), 70 deletions(-) diff --git a/dist/146.index.js b/dist/146.index.js index 6e167cf83..5b991b712 100644 --- a/dist/146.index.js +++ b/dist/146.index.js @@ -118,26 +118,15 @@ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _argume class CreateIssueDuedateComment extends _types_generated__WEBPACK_IMPORTED_MODULE_3__/* .HelperInputs */ .s { } +const daysOpenBasedOnPriority = { + [_constants__WEBPACK_IMPORTED_MODULE_2__/* .PRIORITY_1 */ .N5]: 2, + [_constants__WEBPACK_IMPORTED_MODULE_2__/* .PRIORITY_2 */ .eK]: 14, + [_constants__WEBPACK_IMPORTED_MODULE_2__/* .PRIORITY_3 */ .Yc]: 45, + [_constants__WEBPACK_IMPORTED_MODULE_2__/* .PRIORITY_4 */ .CA]: 90 +}; const commentIssueDueDate = ({ label }) => __awaiter(void 0, void 0, void 0, function* () { const issue_number = _actions_github__WEBPACK_IMPORTED_MODULE_0__.context.issue.number; - // eslint-disable-next-line functional/no-let - let numDaysAllowedOpen; - switch (label) { - case _constants__WEBPACK_IMPORTED_MODULE_2__/* .PRIORITY_1 */ .N5: - numDaysAllowedOpen = 2; - break; - case _constants__WEBPACK_IMPORTED_MODULE_2__/* .PRIORITY_2 */ .eK: - numDaysAllowedOpen = 14; - break; - case _constants__WEBPACK_IMPORTED_MODULE_2__/* .PRIORITY_3 */ .Yc: - numDaysAllowedOpen = 45; - break; - case _constants__WEBPACK_IMPORTED_MODULE_2__/* .PRIORITY_4 */ .CA: - numDaysAllowedOpen = 90; - break; - } - if (!numDaysAllowedOpen) - return; + const numDaysAllowedOpen = daysOpenBasedOnPriority[label]; const response = yield _octokit__WEBPACK_IMPORTED_MODULE_1__/* .octokit.issues.get */ .K.issues.get(Object.assign({ issue_number }, _actions_github__WEBPACK_IMPORTED_MODULE_0__.context.repo)); const issue = response.data; const dateCreated = new Date(issue.created_at); diff --git a/dist/146.index.js.map b/dist/146.index.js.map index 74d43dcd3..32ee6e5c2 100644 --- a/dist/146.index.js.map +++ b/dist/146.index.js.map @@ -1 +1 @@ -{"version":3,"file":"146.index.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;AAWA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;AAWA;;;;;;;;;;;;;;;;;;ACjDA;;;;;;;;;;;AAWA;;;;;;;;;;AAEA;AACA;AACA;AACA;AAEA;AAEA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAAA;AAEA;AAKA;AAEA;AACA;AACA;AAEA;AAKA;;;;;;;;;;;;;;;;;;AC5DA;;;;;;;;;;;AAWA;AAEA;AACA;AACA;AAEA;AACA;;;;;;;;;;;AClBA;;;;;;;;;;;AAWA;AAEA;AA2CA","sources":["webpack://github-helpers/./src/constants.ts","webpack://github-helpers/./src/helpers/comment-issue-due-date.ts","webpack://github-helpers/./src/octokit.ts","webpack://github-helpers/./src/types/generated.ts"],"sourcesContent":["/*\nCopyright 2021 Expedia, Inc.\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n https://www.apache.org/licenses/LICENSE-2.0\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\n// These extra headers are for experimental API features on Github Enterprise. See https://docs.github.com/en/enterprise-server@3.0/rest/overview/api-previews for details.\nconst PREVIEWS = ['ant-man', 'flash', 'groot', 'inertia', 'starfox'];\nexport const GITHUB_OPTIONS = {\n headers: {\n accept: PREVIEWS.map(preview => `application/vnd.github.${preview}-preview+json`).join()\n }\n};\n\nexport const DEFAULT_EXEMPT_DESCRIPTION = 'Passed in case the check is exempt.';\nexport const DEFAULT_PIPELINE_STATUS = 'Pipeline Status';\nexport const DEFAULT_PIPELINE_DESCRIPTION = 'Pipeline clear.';\nexport const PRODUCTION_ENVIRONMENT = 'production';\nexport const LATE_REVIEW = 'Late Review';\nexport const PRIORITY_1 = 'Priority: Critical';\nexport const PRIORITY_2 = 'Priority: High';\nexport const PRIORITY_3 = 'Priority: Medium';\nexport const PRIORITY_4 = 'Priority: Low';\nexport const CORE_APPROVED_PR_LABEL = 'CORE APPROVED';\nexport const PEER_APPROVED_PR_LABEL = 'PEER APPROVED';\nexport const READY_FOR_MERGE_PR_LABEL = 'READY FOR MERGE';\nexport const MERGE_QUEUE_STATUS = 'QUEUE CHECKER';\nexport const QUEUED_FOR_MERGE_PREFIX = 'QUEUED FOR MERGE';\nexport const FIRST_QUEUED_PR_LABEL = `${QUEUED_FOR_MERGE_PREFIX} #1`;\nexport const JUMP_THE_QUEUE_PR_LABEL = 'JUMP THE QUEUE';\nexport const DEFAULT_PR_TITLE_REGEX = '^(build|ci|chore|docs|feat|fix|perf|refactor|style|test|revert|Revert|BREAKING CHANGE)((.*))?: .+$';\nexport const COPYRIGHT_HEADER = `/*\nCopyright 2021 Expedia, Inc.\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n https://www.apache.org/licenses/LICENSE-2.0\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/`;\n","/*\nCopyright 2021 Expedia, Inc.\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n https://www.apache.org/licenses/LICENSE-2.0\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { HelperInputs } from '../types/generated';\nimport { context } from '@actions/github';\nimport { octokit } from '../octokit';\nimport { PRIORITY_1, PRIORITY_2, PRIORITY_3, PRIORITY_4 } from '../constants';\n\nexport class CreateIssueDuedateComment extends HelperInputs {\n label?: string;\n}\n\nexport const commentIssueDueDate = async ({ label }: CreateIssueDuedateComment) => {\n const issue_number = context.issue.number;\n\n // eslint-disable-next-line functional/no-let\n let numDaysAllowedOpen;\n switch (label) {\n case PRIORITY_1:\n numDaysAllowedOpen = 2;\n break;\n case PRIORITY_2:\n numDaysAllowedOpen = 14;\n break;\n case PRIORITY_3:\n numDaysAllowedOpen = 45;\n break;\n case PRIORITY_4:\n numDaysAllowedOpen = 90;\n break;\n }\n\n if (!numDaysAllowedOpen) return;\n\n const response = await octokit.issues.get({\n issue_number,\n ...context.repo\n });\n\n const issue = response.data;\n\n const dateCreated = new Date(issue.created_at);\n // format will be day month date year (ex: Mon Dec 25 2023)\n const dueDate = new Date(dateCreated.getTime() + numDaysAllowedOpen * 86400000);\n\n return octokit.issues.createComment({\n body: `This issue is due on ${dueDate.toDateString()}`,\n issue_number,\n ...context.repo\n });\n};\n","/*\nCopyright 2021 Expedia, Inc.\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n https://www.apache.org/licenses/LICENSE-2.0\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport * as core from '@actions/core';\nimport * as fetch from '@adobe/node-fetch-retry';\nimport { getOctokit } from '@actions/github';\n\nconst githubToken = core.getInput('github_token', { required: true });\nexport const { rest: octokit, graphql: octokitGraphql } = getOctokit(githubToken, { request: { fetch } });\n","/*\nCopyright 2021 Expedia, Inc.\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n https://www.apache.org/licenses/LICENSE-2.0\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nexport class HelperInputs {\n helper?: string;\n github_token?: string;\n body?: string;\n project_name?: string;\n project_destination_column_name?: string;\n note?: string;\n project_origin_column_name?: string;\n sha?: string;\n context?: string;\n state?: string;\n description?: string;\n target_url?: string;\n environment?: string;\n environment_url?: string;\n label?: string;\n labels?: string;\n paths?: string;\n ignore_globs?: string;\n extensions?: string;\n override_filter_paths?: string;\n batches?: string;\n pattern?: string;\n teams?: string;\n login?: string;\n paths_no_filter?: string;\n slack_webhook_url?: string;\n number_of_assignees?: string;\n number_of_reviewers?: string;\n globs?: string;\n override_filter_globs?: string;\n title?: string;\n seconds?: string;\n pull_number?: string;\n base?: string;\n head?: string;\n days?: string;\n no_evict_upon_conflict?: string;\n skip_if_already_set?: string;\n delimiter?: string;\n team?: string;\n ignore_deleted?: string;\n return_full_payload?: string;\n}\n"],"names":[],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"146.index.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;AAWA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;AAWA;;;;;;;;;;;;;;;;;;ACjDA;;;;;;;;;;;AAWA;;;;;;;;;;AAEA;AACA;AACA;AACA;AAEA;AAEA;AAMA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AAEA;AAKA;AAEA;AACA;AACA;AAEA;AAKA;;;;;;;;;;;;;;;;;;ACtDA;;;;;;;;;;;AAWA;AAEA;AACA;AACA;AAEA;AACA;;;;;;;;;;;AClBA;;;;;;;;;;;AAWA;AAEA;AA2CA","sources":["webpack://github-helpers/./src/constants.ts","webpack://github-helpers/./src/helpers/comment-issue-due-date.ts","webpack://github-helpers/./src/octokit.ts","webpack://github-helpers/./src/types/generated.ts"],"sourcesContent":["/*\nCopyright 2021 Expedia, Inc.\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n https://www.apache.org/licenses/LICENSE-2.0\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\n// These extra headers are for experimental API features on Github Enterprise. See https://docs.github.com/en/enterprise-server@3.0/rest/overview/api-previews for details.\nconst PREVIEWS = ['ant-man', 'flash', 'groot', 'inertia', 'starfox'];\nexport const GITHUB_OPTIONS = {\n headers: {\n accept: PREVIEWS.map(preview => `application/vnd.github.${preview}-preview+json`).join()\n }\n};\n\nexport const DEFAULT_EXEMPT_DESCRIPTION = 'Passed in case the check is exempt.';\nexport const DEFAULT_PIPELINE_STATUS = 'Pipeline Status';\nexport const DEFAULT_PIPELINE_DESCRIPTION = 'Pipeline clear.';\nexport const PRODUCTION_ENVIRONMENT = 'production';\nexport const LATE_REVIEW = 'Late Review';\nexport const PRIORITY_1 = 'Priority: Critical';\nexport const PRIORITY_2 = 'Priority: High';\nexport const PRIORITY_3 = 'Priority: Medium';\nexport const PRIORITY_4 = 'Priority: Low';\nexport const CORE_APPROVED_PR_LABEL = 'CORE APPROVED';\nexport const PEER_APPROVED_PR_LABEL = 'PEER APPROVED';\nexport const READY_FOR_MERGE_PR_LABEL = 'READY FOR MERGE';\nexport const MERGE_QUEUE_STATUS = 'QUEUE CHECKER';\nexport const QUEUED_FOR_MERGE_PREFIX = 'QUEUED FOR MERGE';\nexport const FIRST_QUEUED_PR_LABEL = `${QUEUED_FOR_MERGE_PREFIX} #1`;\nexport const JUMP_THE_QUEUE_PR_LABEL = 'JUMP THE QUEUE';\nexport const DEFAULT_PR_TITLE_REGEX = '^(build|ci|chore|docs|feat|fix|perf|refactor|style|test|revert|Revert|BREAKING CHANGE)((.*))?: .+$';\nexport const COPYRIGHT_HEADER = `/*\nCopyright 2021 Expedia, Inc.\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n https://www.apache.org/licenses/LICENSE-2.0\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/`;\n","/*\nCopyright 2021 Expedia, Inc.\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n https://www.apache.org/licenses/LICENSE-2.0\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { HelperInputs } from '../types/generated';\nimport { context } from '@actions/github';\nimport { octokit } from '../octokit';\nimport { PRIORITY_1, PRIORITY_2, PRIORITY_3, PRIORITY_4 } from '../constants';\n\nexport class CreateIssueDuedateComment extends HelperInputs {\n label!: typeof PRIORITY_1 | typeof PRIORITY_2 | typeof PRIORITY_3 | typeof PRIORITY_4;\n}\n\nexport type PriorityDueDateMapping = {\n [key: string]: number;\n};\n\nconst daysOpenBasedOnPriority: PriorityDueDateMapping = {\n [PRIORITY_1]: 2,\n [PRIORITY_2]: 14,\n [PRIORITY_3]: 45,\n [PRIORITY_4]: 90\n};\n\nexport const commentIssueDueDate = async ({ label }: CreateIssueDuedateComment) => {\n const issue_number = context.issue.number;\n\n const numDaysAllowedOpen = daysOpenBasedOnPriority[label];\n\n const response = await octokit.issues.get({\n issue_number,\n ...context.repo\n });\n\n const issue = response.data;\n\n const dateCreated = new Date(issue.created_at);\n // format will be day month date year (ex: Mon Dec 25 2023)\n const dueDate = new Date(dateCreated.getTime() + numDaysAllowedOpen * 86400000);\n\n return octokit.issues.createComment({\n body: `This issue is due on ${dueDate.toDateString()}`,\n issue_number,\n ...context.repo\n });\n};\n","/*\nCopyright 2021 Expedia, Inc.\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n https://www.apache.org/licenses/LICENSE-2.0\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport * as core from '@actions/core';\nimport * as fetch from '@adobe/node-fetch-retry';\nimport { getOctokit } from '@actions/github';\n\nconst githubToken = core.getInput('github_token', { required: true });\nexport const { rest: octokit, graphql: octokitGraphql } = getOctokit(githubToken, { request: { fetch } });\n","/*\nCopyright 2021 Expedia, Inc.\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n https://www.apache.org/licenses/LICENSE-2.0\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nexport class HelperInputs {\n helper?: string;\n github_token?: string;\n body?: string;\n project_name?: string;\n project_destination_column_name?: string;\n note?: string;\n project_origin_column_name?: string;\n sha?: string;\n context?: string;\n state?: string;\n description?: string;\n target_url?: string;\n environment?: string;\n environment_url?: string;\n label?: string;\n labels?: string;\n paths?: string;\n ignore_globs?: string;\n extensions?: string;\n override_filter_paths?: string;\n batches?: string;\n pattern?: string;\n teams?: string;\n login?: string;\n paths_no_filter?: string;\n slack_webhook_url?: string;\n number_of_assignees?: string;\n number_of_reviewers?: string;\n globs?: string;\n override_filter_globs?: string;\n title?: string;\n seconds?: string;\n pull_number?: string;\n base?: string;\n head?: string;\n days?: string;\n no_evict_upon_conflict?: string;\n skip_if_already_set?: string;\n delimiter?: string;\n team?: string;\n ignore_deleted?: string;\n return_full_payload?: string;\n}\n"],"names":[],"sourceRoot":""} \ No newline at end of file diff --git a/src/helpers/comment-issue-due-date.ts b/src/helpers/comment-issue-due-date.ts index fb2afb3e3..b1d2dd732 100644 --- a/src/helpers/comment-issue-due-date.ts +++ b/src/helpers/comment-issue-due-date.ts @@ -17,30 +17,24 @@ import { octokit } from '../octokit'; import { PRIORITY_1, PRIORITY_2, PRIORITY_3, PRIORITY_4 } from '../constants'; export class CreateIssueDuedateComment extends HelperInputs { - label?: string; + label!: typeof PRIORITY_1 | typeof PRIORITY_2 | typeof PRIORITY_3 | typeof PRIORITY_4; } +export type PriorityDueDateMapping = { + [key: string]: number; +}; + +const daysOpenBasedOnPriority: PriorityDueDateMapping = { + [PRIORITY_1]: 2, + [PRIORITY_2]: 14, + [PRIORITY_3]: 45, + [PRIORITY_4]: 90 +}; + export const commentIssueDueDate = async ({ label }: CreateIssueDuedateComment) => { const issue_number = context.issue.number; - // eslint-disable-next-line functional/no-let - let numDaysAllowedOpen; - switch (label) { - case PRIORITY_1: - numDaysAllowedOpen = 2; - break; - case PRIORITY_2: - numDaysAllowedOpen = 14; - break; - case PRIORITY_3: - numDaysAllowedOpen = 45; - break; - case PRIORITY_4: - numDaysAllowedOpen = 90; - break; - } - - if (!numDaysAllowedOpen) return; + const numDaysAllowedOpen = daysOpenBasedOnPriority[label]; const response = await octokit.issues.get({ issue_number, diff --git a/test/helpers/comment-issue-due-date.test.ts b/test/helpers/comment-issue-due-date.test.ts index b39225ae7..4ae40f3ed 100644 --- a/test/helpers/comment-issue-due-date.test.ts +++ b/test/helpers/comment-issue-due-date.test.ts @@ -28,7 +28,8 @@ jest.mock('@actions/github', () => ({ jest.spyOn(Date, 'now').mockImplementation(() => new Date('2023-09-26T10:00:00Z').getTime()); describe('commentIssueDueDate', () => { - it('should add a due date of 2 days ahead when adding a critical priority label', async () => { + it('should add due dates correctly based on priority label', async () => { + // Critical: 2 days (octokit.issues.get as unknown as Mocktokit).mockResolvedValueOnce({ status: '200', data: { @@ -43,8 +44,8 @@ describe('commentIssueDueDate', () => { issue_number: 123, ...context.repo }); - }); - it('should add a due date of 14 days ahead when adding a high priority label', async () => { + + // High: 14 days (octokit.issues.get as unknown as Mocktokit).mockResolvedValueOnce({ status: '200', data: { @@ -59,8 +60,7 @@ describe('commentIssueDueDate', () => { issue_number: 123, ...context.repo }); - }); - it('should add a due date of 45 days ahead when adding a medium priority label', async () => { + // Medium: 45 days (octokit.issues.get as unknown as Mocktokit).mockResolvedValueOnce({ status: '200', data: { @@ -75,8 +75,7 @@ describe('commentIssueDueDate', () => { issue_number: 123, ...context.repo }); - }); - it('should add a due date of 60 days ahead when adding a low priority label', async () => { + // Low: 90 days (octokit.issues.get as unknown as Mocktokit).mockResolvedValueOnce({ status: '200', data: { @@ -92,29 +91,4 @@ describe('commentIssueDueDate', () => { ...context.repo }); }); - it('should not add a due date comment if a label other than priority is passed in', async () => { - (octokit.issues.get as unknown as Mocktokit).mockResolvedValueOnce({ - status: '200', - data: { - issue_number: 123, - created_at: Date.now(), - labels: 'Bug', - ...context.repo - } - }); - await commentIssueDueDate({ label: 'Bug' }); - expect(octokit.issues.createComment).not.toHaveBeenCalled(); - }); - it('should not add a due date comment if no labels are passed in', async () => { - (octokit.issues.get as unknown as Mocktokit).mockResolvedValueOnce({ - status: '200', - data: { - issue_number: 123, - created_at: Date.now(), - ...context.repo - } - }); - await commentIssueDueDate({}); - expect(octokit.issues.createComment).not.toHaveBeenCalled(); - }); });