Files
stale/__tests__/milestones.spec.ts
Chiranjib Swain eaf9131fae refactor: update imports to use ES module syntax and improve test structure (#1350)
- Changed import statements across multiple files to use the .js extension for ES module compatibility.
- Refactored test files to utilize jest's unstable_mockModule for mocking core actions.
- Removed unnecessary spy instances in tests, replacing them with direct mocked function calls.
- Updated TypeScript configuration to target ES2022 and use NodeNext module resolution.
- Removed the tsconfig.spec.json file and adjusted the main tsconfig.json to exclude test files.
2026-07-23 15:39:34 -05:00

3416 lines
190 KiB
TypeScript

import {beforeEach, describe, expect, test} from '@jest/globals';
import {Issue} from '../src/classes/issue.js';
import {IIssuesProcessorOptions} from '../src/interfaces/issues-processor-options.js';
import {IssuesProcessorMock} from './classes/issues-processor-mock.js';
import {DefaultProcessorOptions} from './constants/default-processor-options.js';
import {generateIssue} from './functions/generate-issue.js';
import {alwaysFalseStateMock} from './classes/state-mock.js';
interface ITestData {
isPullRequest: boolean;
milestone: string;
name: string;
shouldStale: boolean;
}
describe('milestones options', (): void => {
let opts: IIssuesProcessorOptions;
let testIssueList: Issue[];
let processor: IssuesProcessorMock;
const setTestIssueList = (
isPullRequest: boolean,
milestone: string | undefined
) => {
testIssueList = [
generateIssue(
opts,
1,
'My first issue',
'2020-01-01T17:00:00Z',
'2020-01-01T17:00:00Z',
false,
isPullRequest,
undefined,
undefined,
undefined,
milestone
)
];
};
const setProcessor = () => {
processor = new IssuesProcessorMock(
opts,
alwaysFalseStateMock,
async p => (p === 1 ? testIssueList : []),
async () => [],
async () => new Date().toDateString()
);
};
beforeEach((): void => {
opts = {...DefaultProcessorOptions};
});
describe('when all the issues and pull requests milestones should not exempt', (): void => {
beforeEach((): void => {
opts.exemptAllMilestones = false;
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone'} | ${'the issue does have a milestone'} | ${true}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone'} | ${'the PR does have a milestone'} | ${true}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
describe('when all the issues milestones are not configured to exempt', (): void => {
beforeEach((): void => {
opts.exemptAllIssueMilestones = undefined;
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone'} | ${'the issue does have a milestone'} | ${true}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone'} | ${'the PR does have a milestone'} | ${true}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
describe('when all the issues and pull requests milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptMilestones = 'dummy-milestone';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific exempted one'} | ${true}
${false} | ${'dummy-milestone'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific exempted one'} | ${true}
${true} | ${'dummy-milestone'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
describe('when all the issues milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptIssueMilestones = 'dummy-issue-milestone';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific issue exempted one'} | ${true}
${false} | ${'dummy-issue-milestone'} | ${'the issue does have a milestone matching the specific issue exempted one'} | ${false}
${false} | ${'dummy-milestone'} | ${'the issue does have a milestone matching the specific exempted one'} | ${true}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific issue exempted one'} | ${true}
${true} | ${'dummy-issue-milestone'} | ${'the PR does have a milestone matching the specific issue exempted one'} | ${true}
${true} | ${'dummy-milestone'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
});
describe('when all the pull requests milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptPrMilestones = 'dummy-pull-request-milestone';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific pull request exempted one'} | ${true}
${false} | ${'dummy-pull-request-milestone'} | ${'the issue does have a milestone matching the specific pull request exempted one'} | ${true}
${false} | ${'dummy-milestone'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific pull request exempted one'} | ${true}
${true} | ${'dummy-pull-request-milestone'} | ${'the PR does have a milestone matching the specific pull request exempted one'} | ${false}
${true} | ${'dummy-milestone'} | ${'the PR does have a milestone matching the specific exempted one'} | ${true}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
});
});
describe('when all the issues and pull requests milestones should exempt some milestones', (): void => {
beforeEach((): void => {
opts.exemptMilestones = 'dummy-milestone1, dummy-milestone2';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific exempted one'} | ${true}
${false} | ${'dummy-milestone2'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific exempted one'} | ${true}
${true} | ${'dummy-milestone2'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
describe('when all the issues milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptIssueMilestones =
'dummy-issue-milestone1, dummy-issue-milestone2';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific issue exempted one'} | ${true}
${false} | ${'dummy-issue-milestone2'} | ${'the issue does have a milestone matching the specific issue exempted one'} | ${false}
${false} | ${'dummy-milestone2'} | ${'the issue does have a milestone matching the specific exempted one'} | ${true}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific issue exempted one'} | ${true}
${true} | ${'dummy-issue-milestone2'} | ${'the PR does have a milestone matching the specific issue exempted one'} | ${true}
${true} | ${'dummy-milestone2'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
});
describe('when all the pull requests milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptPrMilestones =
'dummy-pull-request-milestone1, dummy-pull-request-milestone2';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific pull request exempted one'} | ${true}
${false} | ${'dummy-pull-request-milestone2'} | ${'the issue does have a milestone matching the specific pull request exempted one'} | ${true}
${false} | ${'dummy-milestone2'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific pull request exempted one'} | ${true}
${true} | ${'dummy-pull-request-milestone2'} | ${'the PR does have a milestone matching the specific pull request exempted one'} | ${false}
${true} | ${'dummy-milestone2'} | ${'the PR does have a milestone matching the specific exempted one'} | ${true}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
});
});
});
describe('when all the issues milestones should not exempt', (): void => {
beforeEach((): void => {
opts.exemptAllIssueMilestones = false;
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone'} | ${'the issue does have a milestone'} | ${true}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone'} | ${'the PR does have a milestone'} | ${true}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
describe('when all the issues and pull requests milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptMilestones = 'dummy-milestone';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific exempted one'} | ${true}
${false} | ${'dummy-milestone'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific exempted one'} | ${true}
${true} | ${'dummy-milestone'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
describe('when all the issues milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptIssueMilestones = 'dummy-issue-milestone';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific issue exempted one'} | ${true}
${false} | ${'dummy-issue-milestone'} | ${'the issue does have a milestone matching the specific issue exempted one'} | ${false}
${false} | ${'dummy-milestone'} | ${'the issue does have a milestone matching the specific exempted one'} | ${true}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific issue exempted one'} | ${true}
${true} | ${'dummy-issue-milestone'} | ${'the PR does have a milestone matching the specific issue exempted one'} | ${true}
${true} | ${'dummy-milestone'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
});
describe('when all the pull requests milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptPrMilestones = 'dummy-pull-request-milestone';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific pull request exempted one'} | ${true}
${false} | ${'dummy-pull-request-milestone'} | ${'the issue does have a milestone matching the specific pull request exempted one'} | ${true}
${false} | ${'dummy-milestone'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific pull request exempted one'} | ${true}
${true} | ${'dummy-pull-request-milestone'} | ${'the PR does have a milestone matching the specific pull request exempted one'} | ${false}
${true} | ${'dummy-milestone'} | ${'the PR does have a milestone matching the specific exempted one'} | ${true}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
});
});
describe('when all the issues and pull requests milestones should exempt some milestones', (): void => {
beforeEach((): void => {
opts.exemptMilestones = 'dummy-milestone1, dummy-milestone2';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific exempted one'} | ${true}
${false} | ${'dummy-milestone2'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific exempted one'} | ${true}
${true} | ${'dummy-milestone2'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
describe('when all the issues milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptIssueMilestones =
'dummy-issue-milestone1, dummy-issue-milestone2';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific issue exempted one'} | ${true}
${false} | ${'dummy-issue-milestone2'} | ${'the issue does have a milestone matching the specific issue exempted one'} | ${false}
${false} | ${'dummy-milestone2'} | ${'the issue does have a milestone matching the specific exempted one'} | ${true}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific issue exempted one'} | ${true}
${true} | ${'dummy-issue-milestone2'} | ${'the PR does have a milestone matching the specific issue exempted one'} | ${true}
${true} | ${'dummy-milestone2'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
});
describe('when all the pull requests milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptPrMilestones =
'dummy-pull-request-milestone1, dummy-pull-request-milestone2';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific pull request exempted one'} | ${true}
${false} | ${'dummy-pull-request-milestone2'} | ${'the issue does have a milestone matching the specific pull request exempted one'} | ${true}
${false} | ${'dummy-milestone2'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific pull request exempted one'} | ${true}
${true} | ${'dummy-pull-request-milestone2'} | ${'the PR does have a milestone matching the specific pull request exempted one'} | ${false}
${true} | ${'dummy-milestone2'} | ${'the PR does have a milestone matching the specific exempted one'} | ${true}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
});
});
});
describe('when all the issues milestones should exempt', (): void => {
beforeEach((): void => {
opts.exemptAllIssueMilestones = true;
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone'} | ${'the issue does have a milestone'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone'} | ${'the PR does have a milestone'} | ${true}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
describe('when all the issues and pull requests milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptMilestones = 'dummy-milestone';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific exempted one'} | ${false}
${false} | ${'dummy-milestone'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific exempted one'} | ${true}
${true} | ${'dummy-milestone'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
describe('when all the issues milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptIssueMilestones = 'dummy-issue-milestone';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific issue exempted one'} | ${false}
${false} | ${'dummy-issue-milestone'} | ${'the issue does have a milestone matching the specific issue exempted one'} | ${false}
${false} | ${'dummy-milestone'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific issue exempted one'} | ${true}
${true} | ${'dummy-issue-milestone'} | ${'the PR does have a milestone matching the specific issue exempted one'} | ${true}
${true} | ${'dummy-milestone'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
});
describe('when all the pull requests milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptPrMilestones = 'dummy-pull-request-milestone';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific pull request exempted one'} | ${false}
${false} | ${'dummy-pull-request-milestone'} | ${'the issue does have a milestone matching the specific pull request exempted one'} | ${false}
${false} | ${'dummy-milestone'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific pull request exempted one'} | ${true}
${true} | ${'dummy-pull-request-milestone'} | ${'the PR does have a milestone matching the specific pull request exempted one'} | ${false}
${true} | ${'dummy-milestone'} | ${'the PR does have a milestone matching the specific exempted one'} | ${true}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
});
});
describe('when all the issues and pull requests milestones should exempt some milestones', (): void => {
beforeEach((): void => {
opts.exemptMilestones = 'dummy-milestone1, dummy-milestone2';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific exempted one'} | ${false}
${false} | ${'dummy-milestone2'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific exempted one'} | ${true}
${true} | ${'dummy-milestone2'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
describe('when all the issues milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptIssueMilestones =
'dummy-issue-milestone1, dummy-issue-milestone2';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific issue exempted one'} | ${false}
${false} | ${'dummy-issue-milestone2'} | ${'the issue does have a milestone matching the specific issue exempted one'} | ${false}
${false} | ${'dummy-milestone2'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific issue exempted one'} | ${true}
${true} | ${'dummy-issue-milestone2'} | ${'the PR does have a milestone matching the specific issue exempted one'} | ${true}
${true} | ${'dummy-milestone2'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
});
describe('when all the pull requests milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptPrMilestones =
'dummy-pull-request-milestone1, dummy-pull-request-milestone2';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific pull request exempted one'} | ${false}
${false} | ${'dummy-pull-request-milestone2'} | ${'the issue does have a milestone matching the specific pull request exempted one'} | ${false}
${false} | ${'dummy-milestone2'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific pull request exempted one'} | ${true}
${true} | ${'dummy-pull-request-milestone2'} | ${'the PR does have a milestone matching the specific pull request exempted one'} | ${false}
${true} | ${'dummy-milestone2'} | ${'the PR does have a milestone matching the specific exempted one'} | ${true}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
});
});
});
describe('when all the pull requests milestones are not configured to exempt', (): void => {
beforeEach((): void => {
opts.exemptAllPrMilestones = undefined;
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone'} | ${'the issue does have a milestone'} | ${true}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone'} | ${'the PR does have a milestone'} | ${true}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
describe('when all the issues and pull requests milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptMilestones = 'dummy-milestone';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific exempted one'} | ${true}
${false} | ${'dummy-milestone'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific exempted one'} | ${true}
${true} | ${'dummy-milestone'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
describe('when all the issues milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptIssueMilestones = 'dummy-issue-milestone';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific issue exempted one'} | ${true}
${false} | ${'dummy-issue-milestone'} | ${'the issue does have a milestone matching the specific issue exempted one'} | ${false}
${false} | ${'dummy-milestone'} | ${'the issue does have a milestone matching the specific exempted one'} | ${true}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific issue exempted one'} | ${true}
${true} | ${'dummy-issue-milestone'} | ${'the PR does have a milestone matching the specific issue exempted one'} | ${true}
${true} | ${'dummy-milestone'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
});
describe('when all the pull requests milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptPrMilestones = 'dummy-pull-request-milestone';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific pull request exempted one'} | ${true}
${false} | ${'dummy-pull-request-milestone'} | ${'the issue does have a milestone matching the specific pull request exempted one'} | ${true}
${false} | ${'dummy-milestone'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific pull request exempted one'} | ${true}
${true} | ${'dummy-pull-request-milestone'} | ${'the PR does have a milestone matching the specific pull request exempted one'} | ${false}
${true} | ${'dummy-milestone'} | ${'the PR does have a milestone matching the specific exempted one'} | ${true}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
});
});
describe('when all the issues and pull requests milestones should exempt some milestones', (): void => {
beforeEach((): void => {
opts.exemptMilestones = 'dummy-milestone1, dummy-milestone2';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific exempted one'} | ${true}
${false} | ${'dummy-milestone2'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific exempted one'} | ${true}
${true} | ${'dummy-milestone2'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
describe('when all the issues milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptIssueMilestones =
'dummy-issue-milestone1, dummy-issue-milestone2';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific issue exempted one'} | ${true}
${false} | ${'dummy-issue-milestone2'} | ${'the issue does have a milestone matching the specific issue exempted one'} | ${false}
${false} | ${'dummy-milestone2'} | ${'the issue does have a milestone matching the specific exempted one'} | ${true}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific issue exempted one'} | ${true}
${true} | ${'dummy-issue-milestone2'} | ${'the PR does have a milestone matching the specific issue exempted one'} | ${true}
${true} | ${'dummy-milestone2'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
});
describe('when all the pull requests milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptPrMilestones =
'dummy-pull-request-milestone1, dummy-pull-request-milestone2';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific pull request exempted one'} | ${true}
${false} | ${'dummy-pull-request-milestone2'} | ${'the issue does have a milestone matching the specific pull request exempted one'} | ${true}
${false} | ${'dummy-milestone2'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific pull request exempted one'} | ${true}
${true} | ${'dummy-pull-request-milestone2'} | ${'the PR does have a milestone matching the specific pull request exempted one'} | ${false}
${true} | ${'dummy-milestone2'} | ${'the PR does have a milestone matching the specific exempted one'} | ${true}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
});
});
});
describe('when all the pull requests milestones should not exempt', (): void => {
beforeEach((): void => {
opts.exemptAllPrMilestones = false;
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone'} | ${'the issue does have a milestone'} | ${true}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone'} | ${'the PR does have a milestone'} | ${true}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
describe('when all the issues and pull requests milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptMilestones = 'dummy-milestone';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific exempted one'} | ${true}
${false} | ${'dummy-milestone'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific exempted one'} | ${true}
${true} | ${'dummy-milestone'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
describe('when all the issues milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptIssueMilestones = 'dummy-issue-milestone';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific issue exempted one'} | ${true}
${false} | ${'dummy-issue-milestone'} | ${'the issue does have a milestone matching the specific issue exempted one'} | ${false}
${false} | ${'dummy-milestone'} | ${'the issue does have a milestone matching the specific exempted one'} | ${true}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific issue exempted one'} | ${true}
${true} | ${'dummy-issue-milestone'} | ${'the PR does have a milestone matching the specific issue exempted one'} | ${true}
${true} | ${'dummy-milestone'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
});
describe('when all the pull requests milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptPrMilestones = 'dummy-pull-request-milestone';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific pull request exempted one'} | ${true}
${false} | ${'dummy-pull-request-milestone'} | ${'the issue does have a milestone matching the specific pull request exempted one'} | ${true}
${false} | ${'dummy-milestone'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific pull request exempted one'} | ${true}
${true} | ${'dummy-pull-request-milestone'} | ${'the PR does have a milestone matching the specific pull request exempted one'} | ${false}
${true} | ${'dummy-milestone'} | ${'the PR does have a milestone matching the specific exempted one'} | ${true}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
});
});
describe('when all the issues and pull requests milestones should exempt some milestones', (): void => {
beforeEach((): void => {
opts.exemptMilestones = 'dummy-milestone1, dummy-milestone2';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific exempted one'} | ${true}
${false} | ${'dummy-milestone2'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific exempted one'} | ${true}
${true} | ${'dummy-milestone2'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
describe('when all the issues milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptIssueMilestones =
'dummy-issue-milestone1, dummy-issue-milestone2';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific issue exempted one'} | ${true}
${false} | ${'dummy-issue-milestone2'} | ${'the issue does have a milestone matching the specific issue exempted one'} | ${false}
${false} | ${'dummy-milestone2'} | ${'the issue does have a milestone matching the specific exempted one'} | ${true}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific issue exempted one'} | ${true}
${true} | ${'dummy-issue-milestone2'} | ${'the PR does have a milestone matching the specific issue exempted one'} | ${true}
${true} | ${'dummy-milestone2'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
});
describe('when all the pull requests milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptPrMilestones =
'dummy-pull-request-milestone1, dummy-pull-request-milestone2';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific pull request exempted one'} | ${true}
${false} | ${'dummy-pull-request-milestone2'} | ${'the issue does have a milestone matching the specific pull request exempted one'} | ${true}
${false} | ${'dummy-milestone2'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific pull request exempted one'} | ${true}
${true} | ${'dummy-pull-request-milestone2'} | ${'the PR does have a milestone matching the specific pull request exempted one'} | ${false}
${true} | ${'dummy-milestone2'} | ${'the PR does have a milestone matching the specific exempted one'} | ${true}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
});
});
});
describe('when all the pull requests milestones should exempt', (): void => {
beforeEach((): void => {
opts.exemptAllPrMilestones = true;
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone'} | ${'the issue does have a milestone'} | ${true}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone'} | ${'the PR does have a milestone'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
describe('when all the issues and pull requests milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptMilestones = 'dummy-milestone';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific exempted one'} | ${true}
${false} | ${'dummy-milestone'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific exempted one'} | ${false}
${true} | ${'dummy-milestone'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
describe('when all the issues milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptIssueMilestones = 'dummy-issue-milestone';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific issue exempted one'} | ${true}
${false} | ${'dummy-issue-milestone'} | ${'the issue does have a milestone matching the specific issue exempted one'} | ${false}
${false} | ${'dummy-milestone'} | ${'the issue does have a milestone matching the specific exempted one'} | ${true}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific issue exempted one'} | ${false}
${true} | ${'dummy-issue-milestone'} | ${'the PR does have a milestone matching the specific issue exempted one'} | ${false}
${true} | ${'dummy-milestone'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
});
describe('when all the pull requests milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptPrMilestones = 'dummy-pull-request-milestone';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific pull request exempted one'} | ${true}
${false} | ${'dummy-pull-request-milestone'} | ${'the issue does have a milestone matching the specific pull request exempted one'} | ${true}
${false} | ${'dummy-milestone'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific pull request exempted one'} | ${false}
${true} | ${'dummy-pull-request-milestone'} | ${'the PR does have a milestone matching the specific pull request exempted one'} | ${false}
${true} | ${'dummy-milestone'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
});
});
describe('when all the issues and pull requests milestones should exempt some milestones', (): void => {
beforeEach((): void => {
opts.exemptMilestones = 'dummy-milestone1, dummy-milestone2';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific exempted one'} | ${true}
${false} | ${'dummy-milestone2'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific exempted one'} | ${false}
${true} | ${'dummy-milestone2'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
describe('when all the issues milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptIssueMilestones =
'dummy-issue-milestone1, dummy-issue-milestone2';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific issue exempted one'} | ${true}
${false} | ${'dummy-issue-milestone2'} | ${'the issue does have a milestone matching the specific issue exempted one'} | ${false}
${false} | ${'dummy-milestone2'} | ${'the issue does have a milestone matching the specific exempted one'} | ${true}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific issue exempted one'} | ${false}
${true} | ${'dummy-issue-milestone2'} | ${'the PR does have a milestone matching the specific issue exempted one'} | ${false}
${true} | ${'dummy-milestone2'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
});
describe('when all the pull requests milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptPrMilestones =
'dummy-pull-request-milestone1, dummy-pull-request-milestone2';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific pull request exempted one'} | ${true}
${false} | ${'dummy-pull-request-milestone2'} | ${'the issue does have a milestone matching the specific pull request exempted one'} | ${true}
${false} | ${'dummy-milestone2'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific pull request exempted one'} | ${false}
${true} | ${'dummy-pull-request-milestone2'} | ${'the PR does have a milestone matching the specific pull request exempted one'} | ${false}
${true} | ${'dummy-milestone2'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
});
});
});
});
describe('when all the issues and pull requests milestones should exempt', (): void => {
beforeEach((): void => {
opts.exemptAllMilestones = true;
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone'} | ${'the issue does have a milestone'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone'} | ${'the PR does have a milestone'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
describe('when all the issues milestones are not configured to exempt', (): void => {
beforeEach((): void => {
opts.exemptAllIssueMilestones = undefined;
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone'} | ${'the issue does have a milestone'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone'} | ${'the PR does have a milestone'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
describe('when all the issues and pull requests milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptMilestones = 'dummy-milestone';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific exempted one'} | ${false}
${false} | ${'dummy-milestone'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific exempted one'} | ${false}
${true} | ${'dummy-milestone'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
describe('when all the issues milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptIssueMilestones = 'dummy-issue-milestone';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific issue exempted one'} | ${false}
${false} | ${'dummy-issue-milestone'} | ${'the issue does have a milestone matching the specific issue exempted one'} | ${false}
${false} | ${'dummy-milestone'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific issue exempted one'} | ${false}
${true} | ${'dummy-issue-milestone'} | ${'the PR does have a milestone matching the specific issue exempted one'} | ${false}
${true} | ${'dummy-milestone'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
});
describe('when all the pull requests milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptPrMilestones = 'dummy-pull-request-milestone';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific pull request exempted one'} | ${false}
${false} | ${'dummy-pull-request-milestone'} | ${'the issue does have a milestone matching the specific pull request exempted one'} | ${false}
${false} | ${'dummy-milestone'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific pull request exempted one'} | ${false}
${true} | ${'dummy-pull-request-milestone'} | ${'the PR does have a milestone matching the specific pull request exempted one'} | ${false}
${true} | ${'dummy-milestone'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
});
});
describe('when all the issues and pull requests milestones should exempt some milestones', (): void => {
beforeEach((): void => {
opts.exemptMilestones = 'dummy-milestone1, dummy-milestone2';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific exempted one'} | ${false}
${false} | ${'dummy-milestone2'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific exempted one'} | ${false}
${true} | ${'dummy-milestone2'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
describe('when all the issues milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptIssueMilestones =
'dummy-issue-milestone1, dummy-issue-milestone2';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific issue exempted one'} | ${false}
${false} | ${'dummy-issue-milestone2'} | ${'the issue does have a milestone matching the specific issue exempted one'} | ${false}
${false} | ${'dummy-milestone2'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific issue exempted one'} | ${false}
${true} | ${'dummy-issue-milestone2'} | ${'the PR does have a milestone matching the specific issue exempted one'} | ${false}
${true} | ${'dummy-milestone2'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
});
describe('when all the pull requests milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptPrMilestones =
'dummy-pull-request-milestone1, dummy-pull-request-milestone2';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific pull request exempted one'} | ${false}
${false} | ${'dummy-pull-request-milestone2'} | ${'the issue does have a milestone matching the specific pull request exempted one'} | ${false}
${false} | ${'dummy-milestone2'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific pull request exempted one'} | ${false}
${true} | ${'dummy-pull-request-milestone2'} | ${'the PR does have a milestone matching the specific pull request exempted one'} | ${false}
${true} | ${'dummy-milestone2'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
});
});
});
describe('when all the issues milestones should not exempt', (): void => {
beforeEach((): void => {
opts.exemptAllIssueMilestones = false;
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone'} | ${'the issue does have a milestone'} | ${true}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone'} | ${'the PR does have a milestone'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
describe('when all the issues and pull requests milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptMilestones = 'dummy-milestone';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific exempted one'} | ${true}
${false} | ${'dummy-milestone'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific exempted one'} | ${false}
${true} | ${'dummy-milestone'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
describe('when all the issues milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptIssueMilestones = 'dummy-issue-milestone';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific issue exempted one'} | ${true}
${false} | ${'dummy-issue-milestone'} | ${'the issue does have a milestone matching the specific issue exempted one'} | ${false}
${false} | ${'dummy-milestone'} | ${'the issue does have a milestone matching the specific exempted one'} | ${true}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific issue exempted one'} | ${false}
${true} | ${'dummy-issue-milestone'} | ${'the PR does have a milestone matching the specific issue exempted one'} | ${false}
${true} | ${'dummy-milestone'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
});
describe('when all the pull requests milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptPrMilestones = 'dummy-pull-request-milestone';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific pull request exempted one'} | ${true}
${false} | ${'dummy-pull-request-milestone'} | ${'the issue does have a milestone matching the specific pull request exempted one'} | ${true}
${false} | ${'dummy-milestone'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific pull request exempted one'} | ${false}
${true} | ${'dummy-pull-request-milestone'} | ${'the PR does have a milestone matching the specific pull request exempted one'} | ${false}
${true} | ${'dummy-milestone'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
});
});
describe('when all the issues and pull requests milestones should exempt some milestones', (): void => {
beforeEach((): void => {
opts.exemptMilestones = 'dummy-milestone1, dummy-milestone2';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific exempted one'} | ${true}
${false} | ${'dummy-milestone2'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific exempted one'} | ${false}
${true} | ${'dummy-milestone2'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
describe('when all the issues milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptIssueMilestones =
'dummy-issue-milestone1, dummy-issue-milestone2';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific issue exempted one'} | ${true}
${false} | ${'dummy-issue-milestone2'} | ${'the issue does have a milestone matching the specific issue exempted one'} | ${false}
${false} | ${'dummy-milestone2'} | ${'the issue does have a milestone matching the specific exempted one'} | ${true}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific issue exempted one'} | ${false}
${true} | ${'dummy-issue-milestone2'} | ${'the PR does have a milestone matching the specific issue exempted one'} | ${false}
${true} | ${'dummy-milestone2'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
});
describe('when all the pull requests milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptPrMilestones =
'dummy-pull-request-milestone1, dummy-pull-request-milestone2';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific pull request exempted one'} | ${true}
${false} | ${'dummy-pull-request-milestone2'} | ${'the issue does have a milestone matching the specific pull request exempted one'} | ${true}
${false} | ${'dummy-milestone2'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific pull request exempted one'} | ${false}
${true} | ${'dummy-pull-request-milestone2'} | ${'the PR does have a milestone matching the specific pull request exempted one'} | ${false}
${true} | ${'dummy-milestone2'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
});
});
});
describe('when all the issues milestones should exempt', (): void => {
beforeEach((): void => {
opts.exemptAllIssueMilestones = true;
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone'} | ${'the issue does have a milestone'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone'} | ${'the PR does have a milestone'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
describe('when all the issues and pull requests milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptMilestones = 'dummy-milestone';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific exempted one'} | ${false}
${false} | ${'dummy-milestone'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific exempted one'} | ${false}
${true} | ${'dummy-milestone'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
describe('when all the issues milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptIssueMilestones = 'dummy-issue-milestone';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific issue exempted one'} | ${false}
${false} | ${'dummy-issue-milestone'} | ${'the issue does have a milestone matching the specific issue exempted one'} | ${false}
${false} | ${'dummy-milestone'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific issue exempted one'} | ${false}
${true} | ${'dummy-issue-milestone'} | ${'the PR does have a milestone matching the specific issue exempted one'} | ${false}
${true} | ${'dummy-milestone'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
});
describe('when all the pull requests milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptPrMilestones = 'dummy-pull-request-milestone';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific pull request exempted one'} | ${false}
${false} | ${'dummy-pull-request-milestone'} | ${'the issue does have a milestone matching the specific pull request exempted one'} | ${false}
${false} | ${'dummy-milestone'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific pull request exempted one'} | ${false}
${true} | ${'dummy-pull-request-milestone'} | ${'the PR does have a milestone matching the specific pull request exempted one'} | ${false}
${true} | ${'dummy-milestone'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
});
});
describe('when all the issues and pull requests milestones should exempt some milestones', (): void => {
beforeEach((): void => {
opts.exemptMilestones = 'dummy-milestone1, dummy-milestone2';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific exempted one'} | ${false}
${false} | ${'dummy-milestone2'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific exempted one'} | ${false}
${true} | ${'dummy-milestone2'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
describe('when all the issues milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptIssueMilestones =
'dummy-issue-milestone1, dummy-issue-milestone2';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific issue exempted one'} | ${false}
${false} | ${'dummy-issue-milestone2'} | ${'the issue does have a milestone matching the specific issue exempted one'} | ${false}
${false} | ${'dummy-milestone2'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific issue exempted one'} | ${false}
${true} | ${'dummy-issue-milestone2'} | ${'the PR does have a milestone matching the specific issue exempted one'} | ${false}
${true} | ${'dummy-milestone2'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
});
describe('when all the pull requests milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptPrMilestones =
'dummy-pull-request-milestone1, dummy-pull-request-milestone2';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific pull request exempted one'} | ${false}
${false} | ${'dummy-pull-request-milestone2'} | ${'the issue does have a milestone matching the specific pull request exempted one'} | ${false}
${false} | ${'dummy-milestone2'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific pull request exempted one'} | ${false}
${true} | ${'dummy-pull-request-milestone2'} | ${'the PR does have a milestone matching the specific pull request exempted one'} | ${false}
${true} | ${'dummy-milestone2'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
});
});
});
describe('when all the pull requests milestones are not configured to exempt', (): void => {
beforeEach((): void => {
opts.exemptAllPrMilestones = undefined;
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone'} | ${'the issue does have a milestone'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone'} | ${'the PR does have a milestone'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
describe('when all the issues and pull requests milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptMilestones = 'dummy-milestone';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific exempted one'} | ${false}
${false} | ${'dummy-milestone'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific exempted one'} | ${false}
${true} | ${'dummy-milestone'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
describe('when all the issues milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptIssueMilestones = 'dummy-issue-milestone';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific issue exempted one'} | ${false}
${false} | ${'dummy-issue-milestone'} | ${'the issue does have a milestone matching the specific issue exempted one'} | ${false}
${false} | ${'dummy-milestone'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific issue exempted one'} | ${false}
${true} | ${'dummy-issue-milestone'} | ${'the PR does have a milestone matching the specific issue exempted one'} | ${false}
${true} | ${'dummy-milestone'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
});
describe('when all the pull requests milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptPrMilestones = 'dummy-pull-request-milestone';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific pull request exempted one'} | ${false}
${false} | ${'dummy-pull-request-milestone'} | ${'the issue does have a milestone matching the specific pull request exempted one'} | ${false}
${false} | ${'dummy-milestone'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific pull request exempted one'} | ${false}
${true} | ${'dummy-pull-request-milestone'} | ${'the PR does have a milestone matching the specific pull request exempted one'} | ${false}
${true} | ${'dummy-milestone'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
});
});
describe('when all the issues and pull requests milestones should exempt some milestones', (): void => {
beforeEach((): void => {
opts.exemptMilestones = 'dummy-milestone1, dummy-milestone2';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific exempted one'} | ${false}
${false} | ${'dummy-milestone2'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific exempted one'} | ${false}
${true} | ${'dummy-milestone2'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
describe('when all the issues milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptIssueMilestones =
'dummy-issue-milestone1, dummy-issue-milestone2';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific issue exempted one'} | ${false}
${false} | ${'dummy-issue-milestone2'} | ${'the issue does have a milestone matching the specific issue exempted one'} | ${false}
${false} | ${'dummy-milestone2'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific issue exempted one'} | ${false}
${true} | ${'dummy-issue-milestone2'} | ${'the PR does have a milestone matching the specific issue exempted one'} | ${false}
${true} | ${'dummy-milestone2'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
});
describe('when all the pull requests milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptPrMilestones =
'dummy-pull-request-milestone1, dummy-pull-request-milestone2';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific pull request exempted one'} | ${false}
${false} | ${'dummy-pull-request-milestone2'} | ${'the issue does have a milestone matching the specific pull request exempted one'} | ${false}
${false} | ${'dummy-milestone2'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific pull request exempted one'} | ${false}
${true} | ${'dummy-pull-request-milestone2'} | ${'the PR does have a milestone matching the specific pull request exempted one'} | ${false}
${true} | ${'dummy-milestone2'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
});
});
});
describe('when all the pull requests milestones should not exempt', (): void => {
beforeEach((): void => {
opts.exemptAllPrMilestones = false;
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone'} | ${'the issue does have a milestone'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone'} | ${'the PR does have a milestone'} | ${true}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
describe('when all the issues and pull requests milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptMilestones = 'dummy-milestone';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific exempted one'} | ${false}
${false} | ${'dummy-milestone'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific exempted one'} | ${true}
${true} | ${'dummy-milestone'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
describe('when all the issues milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptIssueMilestones = 'dummy-issue-milestone';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific issue exempted one'} | ${false}
${false} | ${'dummy-issue-milestone'} | ${'the issue does have a milestone matching the specific issue exempted one'} | ${false}
${false} | ${'dummy-milestone'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific issue exempted one'} | ${true}
${true} | ${'dummy-issue-milestone'} | ${'the PR does have a milestone matching the specific issue exempted one'} | ${true}
${true} | ${'dummy-milestone'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
});
describe('when all the pull requests milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptPrMilestones = 'dummy-pull-request-milestone';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific pull request exempted one'} | ${false}
${false} | ${'dummy-pull-request-milestone'} | ${'the issue does have a milestone matching the specific pull request exempted one'} | ${false}
${false} | ${'dummy-milestone'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific pull request exempted one'} | ${true}
${true} | ${'dummy-pull-request-milestone'} | ${'the PR does have a milestone matching the specific pull request exempted one'} | ${false}
${true} | ${'dummy-milestone'} | ${'the PR does have a milestone matching the specific exempted one'} | ${true}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
});
});
describe('when all the issues and pull requests milestones should exempt some milestones', (): void => {
beforeEach((): void => {
opts.exemptMilestones = 'dummy-milestone1, dummy-milestone2';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific exempted one'} | ${false}
${false} | ${'dummy-milestone2'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific exempted one'} | ${true}
${true} | ${'dummy-milestone2'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
describe('when all the issues milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptIssueMilestones =
'dummy-issue-milestone1, dummy-issue-milestone2';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific issue exempted one'} | ${false}
${false} | ${'dummy-issue-milestone2'} | ${'the issue does have a milestone matching the specific issue exempted one'} | ${false}
${false} | ${'dummy-milestone2'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific issue exempted one'} | ${true}
${true} | ${'dummy-issue-milestone2'} | ${'the PR does have a milestone matching the specific issue exempted one'} | ${true}
${true} | ${'dummy-milestone2'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
});
describe('when all the pull requests milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptPrMilestones =
'dummy-pull-request-milestone1, dummy-pull-request-milestone2';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific pull request exempted one'} | ${false}
${false} | ${'dummy-pull-request-milestone2'} | ${'the issue does have a milestone matching the specific pull request exempted one'} | ${false}
${false} | ${'dummy-milestone2'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific pull request exempted one'} | ${true}
${true} | ${'dummy-pull-request-milestone2'} | ${'the PR does have a milestone matching the specific pull request exempted one'} | ${false}
${true} | ${'dummy-milestone2'} | ${'the PR does have a milestone matching the specific exempted one'} | ${true}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
});
});
});
describe('when all the pull requests milestones should exempt', (): void => {
beforeEach((): void => {
opts.exemptAllPrMilestones = true;
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone'} | ${'the issue does have a milestone'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone'} | ${'the PR does have a milestone'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
describe('when all the issues and pull requests milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptMilestones = 'dummy-milestone';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific exempted one'} | ${false}
${false} | ${'dummy-milestone'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific exempted one'} | ${false}
${true} | ${'dummy-milestone'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
describe('when all the issues milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptIssueMilestones = 'dummy-issue-milestone';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific issue exempted one'} | ${false}
${false} | ${'dummy-issue-milestone'} | ${'the issue does have a milestone matching the specific issue exempted one'} | ${false}
${false} | ${'dummy-milestone'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific issue exempted one'} | ${false}
${true} | ${'dummy-issue-milestone'} | ${'the PR does have a milestone matching the specific issue exempted one'} | ${false}
${true} | ${'dummy-milestone'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
});
describe('when all the pull requests milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptPrMilestones = 'dummy-pull-request-milestone';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific pull request exempted one'} | ${false}
${false} | ${'dummy-pull-request-milestone'} | ${'the issue does have a milestone matching the specific pull request exempted one'} | ${false}
${false} | ${'dummy-milestone'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific pull request exempted one'} | ${false}
${true} | ${'dummy-pull-request-milestone'} | ${'the PR does have a milestone matching the specific pull request exempted one'} | ${false}
${true} | ${'dummy-milestone'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
});
});
describe('when all the issues and pull requests milestones should exempt some milestones', (): void => {
beforeEach((): void => {
opts.exemptMilestones = 'dummy-milestone1, dummy-milestone2';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific exempted one'} | ${false}
${false} | ${'dummy-milestone2'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific exempted one'} | ${false}
${true} | ${'dummy-milestone2'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
describe('when all the issues milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptIssueMilestones =
'dummy-issue-milestone1, dummy-issue-milestone2';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific issue exempted one'} | ${false}
${false} | ${'dummy-issue-milestone2'} | ${'the issue does have a milestone matching the specific issue exempted one'} | ${false}
${false} | ${'dummy-milestone2'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific issue exempted one'} | ${false}
${true} | ${'dummy-issue-milestone2'} | ${'the PR does have a milestone matching the specific issue exempted one'} | ${false}
${true} | ${'dummy-milestone2'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
});
describe('when all the pull requests milestones should exempt a specific milestone', (): void => {
beforeEach((): void => {
opts.exemptPrMilestones =
'dummy-pull-request-milestone1, dummy-pull-request-milestone2';
});
describe.each`
isPullRequest | milestone | name | shouldStale
${false} | ${''} | ${'the issue does not have a milestone'} | ${true}
${false} | ${'dummy-milestone-not-exempted'} | ${'the issue does have a milestone but not matching the specific pull request exempted one'} | ${false}
${false} | ${'dummy-pull-request-milestone2'} | ${'the issue does have a milestone matching the specific pull request exempted one'} | ${false}
${false} | ${'dummy-milestone2'} | ${'the issue does have a milestone matching the specific exempted one'} | ${false}
${true} | ${''} | ${'the PR does not have a milestone'} | ${true}
${true} | ${'dummy-milestone-not-exempted'} | ${'the PR does have a milestone but not matching the specific pull request exempted one'} | ${false}
${true} | ${'dummy-pull-request-milestone2'} | ${'the PR does have a milestone matching the specific pull request exempted one'} | ${false}
${true} | ${'dummy-milestone2'} | ${'the PR does have a milestone matching the specific exempted one'} | ${false}
`(
'when $name',
({isPullRequest, milestone, shouldStale}: ITestData): void => {
beforeEach((): void => {
setTestIssueList(isPullRequest, milestone);
setProcessor();
});
test(`should${
shouldStale ? '' : ' not'
} be marked as stale`, async () => {
expect.assertions(3);
await processor.processIssues(1);
expect(processor.staleIssues.length).toStrictEqual(
shouldStale ? 1 : 0
);
expect(processor.closedIssues.length).toStrictEqual(0);
expect(processor.removedLabelIssues.length).toStrictEqual(0);
});
}
);
});
});
});
});
});