feat(logs): enhance the logs for assignees and milestones (#382)

* docs(only-labels): enhance the docs and fix duplicate (#341)

* docs(only-labels): remove duplicated option and improve descriptions

a bad rebase happend

* docs(readme): use a multi-line array and remove the optional column

the option column was not helpful since each value is optional
the multi-line array will allow to have a better UI in small devices and basically in GitHub too due to the max-width

* style(readme): break line for the statistics

* docs(readme): add a better description for the ascending option

* docs(action): add missing punctuation

* build(deps-dev): bump @typescript-eslint/eslint-plugin (#342)

Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 4.15.2 to 4.16.1.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v4.16.1/packages/eslint-plugin)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump @octokit/rest from 18.3.0 to 18.3.2 (#350)

Bumps [@octokit/rest](https://github.com/octokit/rest.js) from 18.3.0 to 18.3.2.
- [Release notes](https://github.com/octokit/rest.js/releases)
- [Commits](https://github.com/octokit/rest.js/compare/v18.3.0...v18.3.2)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* test: add more coverage for the stale label behaviour (#352) (#15)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* test: add more coverage for the stale label behaviour (#352) (#17)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* test: add more coverage for the stale label behaviour (#352) (#18)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* feat(logs): enhance the logs for assignees and milestones

closes #381

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
Geoffrey Testelin
2021-04-28 22:39:28 +02:00
committed by GitHub
parent c70e174d4a
commit 043fbbdea3
5 changed files with 707 additions and 136 deletions

View File

@@ -2,8 +2,8 @@ import {DefaultProcessorOptions} from '../../__tests__/constants/default-process
import {generateIIssue} from '../../__tests__/functions/generate-iissue';
import {IIssue} from '../interfaces/issue';
import {IIssuesProcessorOptions} from '../interfaces/issues-processor-options';
import {Issue} from './issue';
import {Assignees} from './assignees';
import {Issue} from './issue';
describe('Assignees', (): void => {
let assignees: Assignees;
@@ -12,7 +12,10 @@ describe('Assignees', (): void => {
let issueInterface: IIssue;
beforeEach((): void => {
optionsInterface = {...DefaultProcessorOptions};
optionsInterface = {
...DefaultProcessorOptions,
exemptAllAssignees: false
};
issueInterface = generateIIssue();
});
@@ -303,21 +306,51 @@ describe('Assignees', (): void => {
});
});
});
});
describe('when the given issue is a pull request', (): void => {
beforeEach((): void => {
issueInterface.pull_request = {};
});
describe('when the given options are not configured to exempt an assignee', (): void => {
describe('when the given options are configured to exempt all assignees', (): void => {
beforeEach((): void => {
optionsInterface.exemptAssignees = '';
optionsInterface.exemptAllAssignees = true;
});
describe('when the given options are not configured to exempt a pull request with an assignee', (): void => {
describe('when the given issue does not have an assignee', (): void => {
beforeEach((): void => {
optionsInterface.exemptPrAssignees = '';
issueInterface.assignees = [];
});
it('should return false', (): void => {
expect.assertions(1);
issue = new Issue(optionsInterface, issueInterface);
assignees = new Assignees(optionsInterface, issue);
const result = assignees.shouldExemptAssignees();
expect(result).toStrictEqual(false);
});
});
describe('when the given issue does have an assignee', (): void => {
beforeEach((): void => {
issueInterface.assignees = [
{
login: 'dummy-exempt-assignee'
}
];
});
it('should return true', (): void => {
expect.assertions(1);
issue = new Issue(optionsInterface, issueInterface);
assignees = new Assignees(optionsInterface, issue);
const result = assignees.shouldExemptAssignees();
expect(result).toStrictEqual(true);
});
});
describe('when the given options are not configured to exempt all issue assignees', (): void => {
beforeEach((): void => {
optionsInterface.exemptAllIssueAssignees = false;
});
describe('when the given issue does not have an assignee', (): void => {
@@ -337,6 +370,102 @@ describe('Assignees', (): void => {
});
describe('when the given issue does have an assignee', (): void => {
beforeEach((): void => {
issueInterface.assignees = [
{
login: 'dummy-exempt-assignee'
}
];
});
it('should return false', (): void => {
expect.assertions(1);
issue = new Issue(optionsInterface, issueInterface);
assignees = new Assignees(optionsInterface, issue);
const result = assignees.shouldExemptAssignees();
expect(result).toStrictEqual(false);
});
});
});
describe('when the given options are configured to exempt all issue assignees', (): void => {
beforeEach((): void => {
optionsInterface.exemptAllIssueAssignees = true;
});
describe('when the given issue does not have an assignee', (): void => {
beforeEach((): void => {
issueInterface.assignees = [];
});
it('should return false', (): void => {
expect.assertions(1);
issue = new Issue(optionsInterface, issueInterface);
assignees = new Assignees(optionsInterface, issue);
const result = assignees.shouldExemptAssignees();
expect(result).toStrictEqual(false);
});
});
describe('when the given issue does have an assignee', (): void => {
beforeEach((): void => {
issueInterface.assignees = [
{
login: 'dummy-exempt-issue-assignee'
}
];
});
it('should return true', (): void => {
expect.assertions(1);
issue = new Issue(optionsInterface, issueInterface);
assignees = new Assignees(optionsInterface, issue);
const result = assignees.shouldExemptAssignees();
expect(result).toStrictEqual(true);
});
});
});
});
});
describe('when the given issue is a pull request', (): void => {
beforeEach((): void => {
issueInterface.pull_request = {};
});
describe('when the given options are not configured to exempt an assignee', (): void => {
beforeEach((): void => {
optionsInterface.exemptAssignees = '';
});
describe('when the given options are not configured to exempt a pull request with an assignee', (): void => {
beforeEach((): void => {
optionsInterface.exemptPrAssignees = '';
});
describe('when the given pull request does not have an assignee', (): void => {
beforeEach((): void => {
issueInterface.assignees = [];
});
it('should return false', (): void => {
expect.assertions(1);
issue = new Issue(optionsInterface, issueInterface);
assignees = new Assignees(optionsInterface, issue);
const result = assignees.shouldExemptAssignees();
expect(result).toStrictEqual(false);
});
});
describe('when the given pull request does have an assignee', (): void => {
beforeEach((): void => {
issueInterface.assignees = [
{
@@ -362,7 +491,7 @@ describe('Assignees', (): void => {
optionsInterface.exemptPrAssignees = 'dummy-exempt-pr-assignee';
});
describe('when the given issue does not have an assignee', (): void => {
describe('when the given pull request does not have an assignee', (): void => {
beforeEach((): void => {
issueInterface.assignees = [];
});
@@ -378,7 +507,7 @@ describe('Assignees', (): void => {
});
});
describe('when the given issue does have an assignee different than the exempt pull request assignee', (): void => {
describe('when the given pull request does have an assignee different than the exempt pull request assignee', (): void => {
beforeEach((): void => {
issueInterface.assignees = [
{
@@ -398,7 +527,7 @@ describe('Assignees', (): void => {
});
});
describe('when the given issue does have an assignee equaling the exempt pull request assignee', (): void => {
describe('when the given pull request does have an assignee equaling the exempt pull request assignee', (): void => {
beforeEach((): void => {
issueInterface.assignees = [
{
@@ -430,7 +559,7 @@ describe('Assignees', (): void => {
optionsInterface.exemptPrAssignees = '';
});
describe('when the given issue does not have an assignee', (): void => {
describe('when the given pull request does not have an assignee', (): void => {
beforeEach((): void => {
issueInterface.assignees = [];
});
@@ -446,7 +575,7 @@ describe('Assignees', (): void => {
});
});
describe('when the given issue does have an assignee different than the exempt assignee', (): void => {
describe('when the given pull request does have an assignee different than the exempt assignee', (): void => {
beforeEach((): void => {
issueInterface.assignees = [
{
@@ -466,7 +595,7 @@ describe('Assignees', (): void => {
});
});
describe('when the given issue does have an assignee equaling the exempt assignee', (): void => {
describe('when the given pull request does have an assignee equaling the exempt assignee', (): void => {
beforeEach((): void => {
issueInterface.assignees = [
{
@@ -492,7 +621,7 @@ describe('Assignees', (): void => {
optionsInterface.exemptPrAssignees = 'dummy-exempt-pr-assignee';
});
describe('when the given issue does not have an assignee', (): void => {
describe('when the given pull request does not have an assignee', (): void => {
beforeEach((): void => {
issueInterface.assignees = [];
});
@@ -508,7 +637,7 @@ describe('Assignees', (): void => {
});
});
describe('when the given issue does have an assignee different than the exempt pull request assignee', (): void => {
describe('when the given pull request does have an assignee different than the exempt pull request assignee', (): void => {
beforeEach((): void => {
issueInterface.assignees = [
{
@@ -528,7 +657,7 @@ describe('Assignees', (): void => {
});
});
describe('when the given issue does have an assignee equaling the exempt pull request assignee', (): void => {
describe('when the given pull request does have an assignee equaling the exempt pull request assignee', (): void => {
beforeEach((): void => {
issueInterface.assignees = [
{
@@ -548,7 +677,7 @@ describe('Assignees', (): void => {
});
});
describe('when the given issue does have an assignee different than the exempt assignee', (): void => {
describe('when the given pull request does have an assignee different than the exempt assignee', (): void => {
beforeEach((): void => {
issueInterface.assignees = [
{
@@ -568,7 +697,7 @@ describe('Assignees', (): void => {
});
});
describe('when the given issue does have an assignee equaling the exempt assignee', (): void => {
describe('when the given pull request does have an assignee equaling the exempt assignee', (): void => {
beforeEach((): void => {
issueInterface.assignees = [
{
@@ -589,6 +718,132 @@ describe('Assignees', (): void => {
});
});
});
describe('when the given options are configured to exempt all assignees', (): void => {
beforeEach((): void => {
optionsInterface.exemptAllAssignees = true;
});
describe('when the given pull request does not have an assignee', (): void => {
beforeEach((): void => {
issueInterface.assignees = [];
});
it('should return false', (): void => {
expect.assertions(1);
issue = new Issue(optionsInterface, issueInterface);
assignees = new Assignees(optionsInterface, issue);
const result = assignees.shouldExemptAssignees();
expect(result).toStrictEqual(false);
});
});
describe('when the given pull request does have an assignee', (): void => {
beforeEach((): void => {
issueInterface.assignees = [
{
login: 'dummy-exempt-assignee'
}
];
});
it('should return true', (): void => {
expect.assertions(1);
issue = new Issue(optionsInterface, issueInterface);
assignees = new Assignees(optionsInterface, issue);
const result = assignees.shouldExemptAssignees();
expect(result).toStrictEqual(true);
});
});
describe('when the given options are not configured to exempt all pull request assignees', (): void => {
beforeEach((): void => {
optionsInterface.exemptAllPrAssignees = false;
});
describe('when the given pull request does not have an assignee', (): void => {
beforeEach((): void => {
issueInterface.assignees = [];
});
it('should return false', (): void => {
expect.assertions(1);
issue = new Issue(optionsInterface, issueInterface);
assignees = new Assignees(optionsInterface, issue);
const result = assignees.shouldExemptAssignees();
expect(result).toStrictEqual(false);
});
});
describe('when the given pull request does have an assignee', (): void => {
beforeEach((): void => {
issueInterface.assignees = [
{
login: 'dummy-exempt-assignee'
}
];
});
it('should return false', (): void => {
expect.assertions(1);
issue = new Issue(optionsInterface, issueInterface);
assignees = new Assignees(optionsInterface, issue);
const result = assignees.shouldExemptAssignees();
expect(result).toStrictEqual(false);
});
});
});
describe('when the given options are configured to exempt all pull request assignees', (): void => {
beforeEach((): void => {
optionsInterface.exemptAllPrAssignees = true;
});
describe('when the given pull request does not have an assignee', (): void => {
beforeEach((): void => {
issueInterface.assignees = [];
});
it('should return false', (): void => {
expect.assertions(1);
issue = new Issue(optionsInterface, issueInterface);
assignees = new Assignees(optionsInterface, issue);
const result = assignees.shouldExemptAssignees();
expect(result).toStrictEqual(false);
});
});
describe('when the given pull request does have an assignee', (): void => {
beforeEach((): void => {
issueInterface.assignees = [
{
login: 'dummy-exempt-issue-assignee'
}
];
});
it('should return true', (): void => {
expect.assertions(1);
issue = new Issue(optionsInterface, issueInterface);
assignees = new Assignees(optionsInterface, issue);
const result = assignees.shouldExemptAssignees();
expect(result).toStrictEqual(true);
});
});
});
});
});
});
});