mirror of
https://github.com/actions/stale.git
synced 2025-12-27 18:58:16 +00:00
* 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> * docs(operations-per-run): improve the doc for this option * feat(logs): add a new log when an issue consumed at least one operation the log will be visible as the last row of the processing of the given issue closes #348 * chore(readme): improve the operations per run Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com> * chore(readme): improve the operations per run Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com> * chore(readme): improve the operations per run Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com> * chore(readme): improve the operations per run Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com> * chore(readme): improve the operations per run Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com> * chore(readme): improve the operations per run Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com> * Typo in how to perform check for specific labels (#357) Not tests but feels like a typo. Or if we keep the title it `exempt` feels more approriate: exempt-issue-labels: 'roadmap' exempt-pr-labels: 'roadmap' * feat(any-of-labels): add 2 new options to customize for issues/PRs (#380) * 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(any-of-labels): add 2 new options to customize for issues/PRs closes #371 change this option and only-labels to have tree-logs * chore(index): update it Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * 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> * style(typo): fix typo plural issue * style(naming): rename two methods * chore(error): remove a potential useless throw of error * style(naming): rename one method * refactor(issue): change the way to count the operations * refactor(operations): create a method to reduce code duplication Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com> Co-authored-by: Romain Rigaux <romain.rigaux@gmail.com>
135 lines
3.9 KiB
TypeScript
135 lines
3.9 KiB
TypeScript
import {DefaultProcessorOptions} from '../../__tests__/constants/default-processor-options';
|
|
import {IIssuesProcessorOptions} from '../interfaces/issues-processor-options';
|
|
import {StaleOperations} from './stale-operations';
|
|
|
|
interface IHasRemainingOperationsMatrix {
|
|
operationsPerRun: number;
|
|
consumeOperations: number;
|
|
hasRemainingOperations: number;
|
|
}
|
|
|
|
interface IGetRemainingOperationsCountMatrix {
|
|
operationsPerRun: number;
|
|
consumeOperations: number;
|
|
getRemainingOperationsCount: number;
|
|
}
|
|
|
|
describe('StaleOperations', (): void => {
|
|
let operations: StaleOperations;
|
|
let options: IIssuesProcessorOptions;
|
|
|
|
beforeEach((): void => {
|
|
options = {...DefaultProcessorOptions};
|
|
});
|
|
|
|
describe('consumeOperation()', (): void => {
|
|
beforeEach((): void => {
|
|
operations = new StaleOperations(options);
|
|
});
|
|
|
|
it('should increase the count of operation consume by 1', (): void => {
|
|
expect.assertions(1);
|
|
operations.consumeOperation();
|
|
|
|
const result = operations.getConsumedOperationsCount();
|
|
|
|
expect(result).toStrictEqual(1);
|
|
});
|
|
});
|
|
|
|
describe('consumeOperations()', (): void => {
|
|
beforeEach((): void => {
|
|
operations = new StaleOperations(options);
|
|
});
|
|
|
|
it('should increase the count of operation consume by the provided quantity', (): void => {
|
|
expect.assertions(1);
|
|
operations.consumeOperations(8);
|
|
|
|
const result = operations.getConsumedOperationsCount();
|
|
|
|
expect(result).toStrictEqual(8);
|
|
});
|
|
});
|
|
|
|
describe('getConsumedOperationsCount()', (): void => {
|
|
beforeEach((): void => {
|
|
operations = new StaleOperations(options);
|
|
});
|
|
|
|
it('should return 0 by default', (): void => {
|
|
expect.assertions(1);
|
|
|
|
const result = operations.getConsumedOperationsCount();
|
|
|
|
expect(result).toStrictEqual(0);
|
|
});
|
|
});
|
|
|
|
describe('hasRemainingOperations()', (): void => {
|
|
beforeEach((): void => {
|
|
operations = new StaleOperations(options);
|
|
});
|
|
|
|
describe.each`
|
|
operationsPerRun | consumeOperations | hasRemainingOperations
|
|
${1} | ${1} | ${false}
|
|
${2} | ${1} | ${true}
|
|
`(
|
|
'when the operations per run is $operationsPerRun and $consumeOperations operations were consumed',
|
|
({
|
|
operationsPerRun,
|
|
consumeOperations,
|
|
hasRemainingOperations
|
|
}: IHasRemainingOperationsMatrix): void => {
|
|
beforeEach((): void => {
|
|
options.operationsPerRun = operationsPerRun;
|
|
operations = new StaleOperations(options);
|
|
});
|
|
|
|
it(`should return ${hasRemainingOperations}`, (): void => {
|
|
expect.assertions(1);
|
|
operations.consumeOperations(consumeOperations);
|
|
|
|
const result = operations.hasRemainingOperations();
|
|
|
|
expect(result).toStrictEqual(hasRemainingOperations);
|
|
});
|
|
}
|
|
);
|
|
});
|
|
|
|
describe('getRemainingOperationsCount()', (): void => {
|
|
beforeEach((): void => {
|
|
operations = new StaleOperations(options);
|
|
});
|
|
|
|
describe.each`
|
|
operationsPerRun | consumeOperations | getRemainingOperationsCount
|
|
${1} | ${1} | ${0}
|
|
${2} | ${1} | ${1}
|
|
`(
|
|
'when the operations per run is $operationsPerRun and $consumeOperations operations were consumed',
|
|
({
|
|
operationsPerRun,
|
|
consumeOperations,
|
|
getRemainingOperationsCount
|
|
}: IGetRemainingOperationsCountMatrix): void => {
|
|
beforeEach((): void => {
|
|
options.operationsPerRun = operationsPerRun;
|
|
operations = new StaleOperations(options);
|
|
});
|
|
|
|
it(`should return ${getRemainingOperationsCount}`, (): void => {
|
|
expect.assertions(1);
|
|
operations.consumeOperations(consumeOperations);
|
|
|
|
const result = operations.getRemainingOperationsCount();
|
|
|
|
expect(result).toStrictEqual(getRemainingOperationsCount);
|
|
});
|
|
}
|
|
);
|
|
});
|
|
});
|