diff --git a/__tests__/any-of-labels.spec.ts b/__tests__/any-of-labels.spec.ts index 39734b30..3b96fea4 100644 --- a/__tests__/any-of-labels.spec.ts +++ b/__tests__/any-of-labels.spec.ts @@ -1141,6 +1141,7 @@ class IssuesProcessorBuilder { this._options, async p => (p === 1 ? this._issues : []), async () => [], + async () => [], async () => new Date().toDateString() ); } diff --git a/__tests__/assignees.spec.ts b/__tests__/assignees.spec.ts index 86c45349..669b6e50 100644 --- a/__tests__/assignees.spec.ts +++ b/__tests__/assignees.spec.ts @@ -50,6 +50,7 @@ describe('assignees options', (): void => { opts, async p => (p === 1 ? testIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); }; diff --git a/__tests__/classes/issues-processor-mock.ts b/__tests__/classes/issues-processor-mock.ts index 0ef05ed2..5443ad9c 100644 --- a/__tests__/classes/issues-processor-mock.ts +++ b/__tests__/classes/issues-processor-mock.ts @@ -1,6 +1,7 @@ import {Issue} from '../../src/classes/issue'; import {IssuesProcessor} from '../../src/classes/issues-processor'; import {IComment} from '../../src/interfaces/comment'; +import {IReaction} from '../../src/interfaces/reaction'; import {IIssuesProcessorOptions} from '../../src/interfaces/issues-processor-options'; import {IPullRequest} from '../../src/interfaces/pull-request'; @@ -12,6 +13,10 @@ export class IssuesProcessorMock extends IssuesProcessor { issue: Issue, sinceDate: string ) => Promise, + listIssueReactions?: ( + issue: Issue, + sinceDate: string + ) => Promise, getLabelCreationDate?: ( issue: Issue, label: string @@ -28,6 +33,10 @@ export class IssuesProcessorMock extends IssuesProcessor { this.listIssueComments = listIssueComments; } + if (listIssueReactions) { + this.listIssueReactions = listIssueReactions; + } + if (getLabelCreationDate) { this.getLabelCreationDate = getLabelCreationDate; } diff --git a/__tests__/constants/default-processor-options.ts b/__tests__/constants/default-processor-options.ts index 0265b644..b171806a 100644 --- a/__tests__/constants/default-processor-options.ts +++ b/__tests__/constants/default-processor-options.ts @@ -53,6 +53,7 @@ export const DefaultProcessorOptions: IIssuesProcessorOptions = Object.freeze({ ignoreUpdates: false, ignoreIssueUpdates: undefined, ignorePrUpdates: undefined, + ignoreReactions: undefined, exemptDraftPr: false, closeIssueReason: 'not_planned', includeOnlyAssigned: false diff --git a/__tests__/exempt-draft-pr.spec.ts b/__tests__/exempt-draft-pr.spec.ts index 7291f5a0..c1a18e96 100644 --- a/__tests__/exempt-draft-pr.spec.ts +++ b/__tests__/exempt-draft-pr.spec.ts @@ -124,6 +124,7 @@ class IssuesProcessorBuilder { this._options, async p => (p === 1 ? this._issues : []), async () => [], + async () => [], async () => new Date().toDateString(), async (): Promise => { return Promise.resolve({ diff --git a/__tests__/main.spec.ts b/__tests__/main.spec.ts index 0675a5b7..c855f172 100644 --- a/__tests__/main.spec.ts +++ b/__tests__/main.spec.ts @@ -18,6 +18,7 @@ test('processing an issue with no label will make it stale and close it, if it i opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -49,6 +50,7 @@ test('processing an issue with no label and a start date as ECMAScript epoch in opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -80,6 +82,7 @@ test('processing an issue with no label and a start date as ECMAScript epoch in opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -111,6 +114,7 @@ test('processing an issue with no label and a start date as ECMAScript epoch in opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -142,6 +146,7 @@ test('processing an issue with no label and a start date as ECMAScript epoch in opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -173,6 +178,7 @@ test('processing an issue with no label and a start date as ISO 8601 being befor opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -204,6 +210,7 @@ test('processing an issue with no label and a start date as ISO 8601 being after opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -235,6 +242,7 @@ test('processing an issue with no label and a start date as RFC 2822 being befor opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -266,6 +274,7 @@ test('processing an issue with no label and a start date as RFC 2822 being after opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -289,6 +298,7 @@ test('processing an issue with no label will make it stale and close it, if it i opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -313,6 +323,7 @@ test('processing an issue with no label will make it stale and not close it, if opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -335,6 +346,7 @@ test('processing an issue with no label will make it stale and not close it if d opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -358,6 +370,7 @@ test('processing an issue with no label will make it stale and not close it if d opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -381,6 +394,7 @@ test('processing an issue with no label will not make it stale if days-before-st opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -405,6 +419,7 @@ test('processing an issue with no label will not make it stale if days-before-st opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -432,6 +447,7 @@ test('processing an issue with no label will make it stale but not close it', as DefaultProcessorOptions, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -462,6 +478,7 @@ test('processing a stale issue will close it', async () => { opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -492,6 +509,7 @@ test('processing a stale issue containing a space in the label will close it', a opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -522,6 +540,7 @@ test('processing a stale issue containing a slash in the label will close it', a opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -553,6 +572,7 @@ test('processing a stale issue will close it when days-before-issue-stale overri opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -583,6 +603,7 @@ test('processing a stale PR will close it', async () => { opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -614,6 +635,7 @@ test('processing a stale PR will close it when days-before-pr-stale override day opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -645,6 +667,7 @@ test('processing a stale issue will close it even if configured not to mark as s opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -677,6 +700,7 @@ test('processing a stale issue will close it even if configured not to mark as s opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -708,6 +732,7 @@ test('processing a stale PR will close it even if configured not to mark as stal opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -740,6 +765,7 @@ test('processing a stale PR will close it even if configured not to mark as stal opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -793,6 +819,7 @@ test('stale closed issues will not be closed', async () => { DefaultProcessorOptions, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -820,6 +847,7 @@ test('closed prs will not be marked stale', async () => { DefaultProcessorOptions, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -847,6 +875,7 @@ test('stale closed prs will not be closed', async () => { DefaultProcessorOptions, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -900,6 +929,7 @@ test('stale locked issues will not be closed', async () => { DefaultProcessorOptions, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -953,6 +983,7 @@ test('stale locked prs will not be closed', async () => { DefaultProcessorOptions, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -982,6 +1013,7 @@ test('exempt issue labels will not be marked stale', async () => { opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -1011,6 +1043,7 @@ test('exempt issue labels will not be marked stale (multi issue label with space opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -1039,6 +1072,7 @@ test('exempt issue labels will not be marked stale (multi issue label)', async ( opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -1085,6 +1119,7 @@ test('exempt pr labels will not be marked stale', async () => { opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -1130,6 +1165,7 @@ test('stale issues should not be closed if days is set to -1', async () => { opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -1165,6 +1201,7 @@ test('stale label should be removed if a comment was added to a stale issue', as body: 'Body' } ], // return a fake comment to indicate there was an update + async () => [], async () => new Date().toDateString() ); @@ -1206,6 +1243,7 @@ test('when the option "labelsToAddWhenUnstale" is set, the labels should be adde body: 'Body' } ], // return a fake comment to indicate there was an update + async () => [], async () => new Date().toDateString() ); @@ -1250,6 +1288,7 @@ test('when the option "labelsToRemoveWhenStale" is set, the labels should be rem body: 'Body' } ], // return a fake comment to indicate there was an update + async () => [], async () => new Date().toDateString() ); @@ -1288,6 +1327,7 @@ test('stale label should not be removed if a comment was added by the bot (and t body: 'This issue is stale' } ], // return a fake comment to indicate there was an update by the bot + async () => [], async () => new Date().toDateString() ); @@ -1320,6 +1360,7 @@ test('stale label containing a space should be removed if a comment was added to opts, async p => (p === 1 ? TestIssueList : []), async () => [{user: {login: 'notme', type: 'User'}, body: 'Body'}], // return a fake comment to indicate there was an update + async () => [], async () => new Date().toDateString() ); @@ -1351,6 +1392,7 @@ test('stale issues should not be closed until after the closed number of days', opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -1383,6 +1425,7 @@ test('stale issues should be closed if the closed nubmer of days (additive) is a opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -1414,6 +1457,7 @@ test('stale issues should not be closed until after the closed number of days (l opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -1446,6 +1490,7 @@ test('skips stale message on issues when stale-issue-message is empty', async () opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -1490,6 +1535,7 @@ test('send stale message on issues when stale-issue-message is not empty', async opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -1534,6 +1580,7 @@ test('skips stale message on prs when stale-pr-message is empty', async () => { opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -1578,6 +1625,7 @@ test('send stale message on prs when stale-pr-message is not empty', async () => opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -1619,6 +1667,7 @@ test('git branch is deleted when option is enabled', async () => { opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -1648,6 +1697,7 @@ test('git branch is not deleted when issue is not pull request', async () => { opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -1679,6 +1729,7 @@ test('an issue without a milestone will be marked as stale', async () => { DefaultProcessorOptions, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -1712,6 +1763,7 @@ test('an issue without an exempted milestone will be marked as stale', async () opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -1745,6 +1797,7 @@ test('an issue with an exempted milestone will not be marked as stale', async () opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -1778,6 +1831,7 @@ test('an issue with an exempted milestone will not be marked as stale (multi mil opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -1811,6 +1865,7 @@ test('an issue with an exempted milestone will not be marked as stale (multi mil opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -1845,6 +1900,7 @@ test('an issue with an exempted milestone but without an exempted issue mileston opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -1879,6 +1935,7 @@ test('an issue with an exempted milestone but with another exempted issue milest opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -1913,6 +1970,7 @@ test('an issue with an exempted milestone and with an exempted issue milestone w opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -1940,6 +1998,7 @@ test('processing an issue opened since 2 days and with the option "daysBeforeIss opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -1966,6 +2025,7 @@ test('processing an issue opened since 2 days and with the option "daysBeforeIss opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -1992,6 +2052,7 @@ test('processing an issue opened since 2 days and with the option "daysBeforeIss opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -2018,6 +2079,7 @@ test('processing an issue opened since 1 hour and with the option "daysBeforeIss opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toISOString() ); @@ -2044,6 +2106,7 @@ test('processing an issue opened since 4 hours and with the option "daysBeforeIs opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toISOString() ); @@ -2070,6 +2133,7 @@ test('processing an issue opened since 5 hours and with the option "daysBeforeIs opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toISOString() ); @@ -2103,6 +2167,7 @@ test('processing a pull request opened since 2 days and with the option "daysBef opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -2136,6 +2201,7 @@ test('processing a pull request opened since 2 days and with the option "daysBef opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -2169,6 +2235,7 @@ test('processing a pull request opened since 2 days and with the option "daysBef opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -2202,6 +2269,7 @@ test('processing a pull request opened since 1 hour and with the option "daysBef opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toISOString() ); @@ -2235,6 +2303,7 @@ test('processing a pull request opened since 4 hours and with the option "daysBe opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toISOString() ); @@ -2268,6 +2337,7 @@ test('processing a pull request opened since 5 hours and with the option "daysBe opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toISOString() ); @@ -2304,6 +2374,7 @@ test('processing a previously closed issue with a close label will remove the cl opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -2339,6 +2410,7 @@ test('processing a closed issue with a close label will not remove the close lab opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -2374,6 +2446,7 @@ test('processing a locked issue with a close label will not remove the close lab opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -2413,6 +2486,7 @@ test('processing an issue stale since less than the daysBeforeStale with a stale opts, async p => (p === 1 ? TestIssueList : []), async (): Promise => Promise.resolve([]), + async () => [], async () => labelCreatedAt.toDateString() ); @@ -2453,6 +2527,7 @@ test('processing an issue stale since less than the daysBeforeStale without a st opts, async p => (p === 1 ? TestIssueList : []), async (): Promise => Promise.resolve([]), + async () => [], async () => new Date().toDateString() ); @@ -2488,6 +2563,7 @@ test('processing a pull request to be stale with the "stalePrMessage" option set opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -2523,6 +2599,7 @@ test('processing a pull request to be stale with the "stalePrMessage" option set opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -2563,6 +2640,7 @@ test('processing an issue with the "includeOnlyAssigned" option and nonempty ass opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); @@ -2590,6 +2668,7 @@ test('processing an issue with the "includeOnlyAssigned" option set and no assig opts, async p => (p === 1 ? TestIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); diff --git a/__tests__/milestones.spec.ts b/__tests__/milestones.spec.ts index 3483d59d..e044d5c5 100644 --- a/__tests__/milestones.spec.ts +++ b/__tests__/milestones.spec.ts @@ -41,6 +41,7 @@ describe('milestones options', (): void => { opts, async p => (p === 1 ? testIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); }; diff --git a/__tests__/only-labels.spec.ts b/__tests__/only-labels.spec.ts index d1f070f3..3039bd1a 100644 --- a/__tests__/only-labels.spec.ts +++ b/__tests__/only-labels.spec.ts @@ -1141,6 +1141,7 @@ class IssuesProcessorBuilder { this._options, async p => (p === 1 ? this._issues : []), async () => [], + async () => [], async () => new Date().toDateString() ); } diff --git a/__tests__/operations-per-run.spec.ts b/__tests__/operations-per-run.spec.ts index f42397c9..f1a58dfe 100644 --- a/__tests__/operations-per-run.spec.ts +++ b/__tests__/operations-per-run.spec.ts @@ -207,6 +207,7 @@ class SUT { this._opts, async p => (p === 1 ? this._testIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); diff --git a/__tests__/remove-stale-when-updated.spec.ts b/__tests__/remove-stale-when-updated.spec.ts index 98092d80..8c2458bc 100644 --- a/__tests__/remove-stale-when-updated.spec.ts +++ b/__tests__/remove-stale-when-updated.spec.ts @@ -549,6 +549,7 @@ class IssuesProcessorBuilder { body: 'body' } ], + async () => [], async () => new Date().toDateString() ); } diff --git a/__tests__/updates-reset-stale.spec.ts b/__tests__/updates-reset-stale.spec.ts index 11865ecf..a50d0932 100644 --- a/__tests__/updates-reset-stale.spec.ts +++ b/__tests__/updates-reset-stale.spec.ts @@ -688,6 +688,7 @@ class SUT { this._opts, async p => (p === 1 ? this._testIssueList : []), async () => [], + async () => [], async () => new Date().toDateString() ); diff --git a/src/classes/issue.spec.ts b/src/classes/issue.spec.ts index 10a7eea7..ee9a76cd 100644 --- a/src/classes/issue.spec.ts +++ b/src/classes/issue.spec.ts @@ -62,6 +62,7 @@ describe('Issue', (): void => { ignoreUpdates: false, ignoreIssueUpdates: undefined, ignorePrUpdates: undefined, + ignoreReactions: undefined, exemptDraftPr: false, closeIssueReason: '', includeOnlyAssigned: false