Update how stale handles exempt items (#874)

This commit is contained in:
John Sudol
2022-12-20 15:35:06 -05:00
committed by GitHub
parent 10dc265f2c
commit eed91cbd05
4 changed files with 21 additions and 62 deletions

View File

@@ -1094,44 +1094,6 @@ test('exempt pr labels will not be marked stale', async () => {
expect(processor.staleIssues).toHaveLength(2); // PR should get processed even though it has an exempt **issue** label
});
test('exempt issue labels will not be marked stale and will remove the existing stale label', async () => {
expect.assertions(3);
const opts = {...DefaultProcessorOptions};
opts.exemptIssueLabels = 'Exempt';
const TestIssueList: Issue[] = [
generateIssue(
opts,
1,
'My first issue',
'2020-01-01T17:00:00Z',
'2020-01-01T17:00:00Z',
false,
['Exempt', 'Stale']
)
];
const processor = new IssuesProcessorMock(
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 () => new Date().toDateString()
);
// process our fake issue list
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(0);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(1);
});
test('stale issues should not be closed if days is set to -1', async () => {
const opts = {...DefaultProcessorOptions};
opts.daysBeforeClose = -1;