Add a start date option to ignore old issues and PRs (#269)

* docs(readme): add a small precision about the operations-per-run

closes #230

* chore(lint): ignore the lib folder for prettier

* chore(date): add a function to check if a date is valid

* chore(date): add a function to get a humanized date

* chore(date): add a function to check if the date is more recent than

* feat(date): add a start date to ignore old issues and PRs

closes #174

* docs(readme): change the date to match the description

* chore(date): add a better type for the date

* docs(date): add missing JSDoc about the return type

* chore(rebase): fix issues due to rebase

* docs(readme): fix table formatting issues
This commit is contained in:
Geoffrey Testelin
2021-01-18 02:22:36 +01:00
committed by GitHub
parent 7f340a46f3
commit f698371c0d
19 changed files with 694 additions and 69 deletions

View File

@@ -0,0 +1,51 @@
import {isDateMoreRecentThan} from './is-date-more-recent-than';
describe('isDateMoreRecentThan()', (): void => {
let date: Date;
let comparedDate: Date;
describe('when the given date is older than the compared date', (): void => {
beforeEach((): void => {
date = new Date(2020, 0, 20);
comparedDate = new Date(2021, 0, 20);
});
it('should return false', (): void => {
expect.assertions(1);
const result = isDateMoreRecentThan(date, comparedDate);
expect(result).toStrictEqual(false);
});
});
describe('when the given date is equal to the compared date', (): void => {
beforeEach((): void => {
date = new Date(2020, 0, 20);
comparedDate = new Date(2020, 0, 20);
});
it('should return false', (): void => {
expect.assertions(1);
const result = isDateMoreRecentThan(date, comparedDate);
expect(result).toStrictEqual(false);
});
});
describe('when the given date is more recent than the compared date', (): void => {
beforeEach((): void => {
date = new Date(2021, 0, 20);
comparedDate = new Date(2020, 0, 20);
});
it('should return true', (): void => {
expect.assertions(1);
const result = isDateMoreRecentThan(date, comparedDate);
expect(result).toStrictEqual(true);
});
});
});