Revert "feat(options): add new options to avoid stale base on comments (#494)" (#507)

This reverts commit 1efddcbe9f.
This commit is contained in:
Geoffrey Testelin
2021-06-15 23:16:31 +02:00
committed by GitHub
parent f2ae27a59b
commit d3bfc50685
12 changed files with 79 additions and 827 deletions

View File

@@ -1220,7 +1220,7 @@ test('stale issues should not be closed if days is set to -1', async () => {
});
test('stale label should be removed if a comment was added to a stale issue', async () => {
const opts = {...DefaultProcessorOptions, removeStaleWhenCommented: true};
const opts = {...DefaultProcessorOptions, removeStaleWhenUpdated: true};
const TestIssueList: Issue[] = [
generateIssue(
opts,
@@ -1259,7 +1259,7 @@ test('when the option "labelsToAddWhenUnstale" is set, the labels should be adde
expect.assertions(4);
const opts = {
...DefaultProcessorOptions,
removeStaleWhenCommented: true,
removeStaleWhenUpdated: true,
labelsToAddWhenUnstale: 'test'
};
const TestIssueList: Issue[] = [
@@ -1299,37 +1299,8 @@ test('when the option "labelsToAddWhenUnstale" is set, the labels should be adde
expect(processor.addedLabelIssues).toHaveLength(1);
});
test('stale label should be removed if a stale issue was updated', async () => {
const opts = {...DefaultProcessorOptions, removeStaleWhenUpdated: true};
const TestIssueList: Issue[] = [
generateIssue(
opts,
1,
'An issue that should un-stale',
new Date().toDateString(),
'2020-01-01T17:00:00Z',
false,
['Stale']
)
];
const processor = new IssuesProcessorMock(
opts,
async () => 'abot',
async p => (p === 1 ? TestIssueList : []),
async () => [],
async () => '2020-01-02T17:00:00Z'
);
// process our fake issue list
await processor.processIssues(1);
expect(processor.closedIssues).toHaveLength(0);
expect(processor.staleIssues).toHaveLength(0);
expect(processor.removedLabelIssues).toHaveLength(1);
});
test('stale label should not be removed if a comment was added by the bot (and the issue should be closed)', async () => {
const opts = {...DefaultProcessorOptions, removeStaleWhenCommented: true};
const opts = {...DefaultProcessorOptions, removeStaleWhenUpdated: true};
github.context.actor = 'abot';
const TestIssueList: Issue[] = [
generateIssue(
@@ -1368,7 +1339,7 @@ test('stale label should not be removed if a comment was added by the bot (and t
test('stale label containing a space should be removed if a comment was added to a stale issue', async () => {
const opts: IIssuesProcessorOptions = {
...DefaultProcessorOptions,
removeStaleWhenCommented: true,
removeStaleWhenUpdated: true,
staleIssueLabel: 'stat: stale'
};
const TestIssueList: Issue[] = [
@@ -2307,7 +2278,7 @@ test('processing an issue stale since less than the daysBeforeStale with a stale
daysBeforeStale: 30,
daysBeforeClose: 7,
closeIssueMessage: 'close message',
removeStaleWhenCommented: false
removeStaleWhenUpdated: false
};
const now: Date = new Date();
const updatedAt: Date = new Date(now.setDate(now.getDate() - 9));
@@ -2349,7 +2320,7 @@ test('processing an issue stale since less than the daysBeforeStale without a st
daysBeforeStale: 30,
daysBeforeClose: 7,
closeIssueMessage: 'close message',
removeStaleWhenCommented: false
removeStaleWhenUpdated: false
};
const now: Date = new Date();
const updatedAt: Date = new Date(now.setDate(now.getDate() - 9));