mirror of
https://github.com/actions/stale.git
synced 2025-12-27 10:48:18 +00:00
* 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
34 lines
843 B
TypeScript
34 lines
843 B
TypeScript
import {getHumanizedDate} from './get-humanized-date';
|
|
|
|
describe('getHumanizedDate()', (): void => {
|
|
let date: Date;
|
|
|
|
describe('when the given date is the 1st of april 2020', (): void => {
|
|
beforeEach((): void => {
|
|
date = new Date(2020, 3, 1);
|
|
});
|
|
|
|
it('should return the date formatted as DD-MM-YYYY', (): void => {
|
|
expect.assertions(1);
|
|
|
|
const result = getHumanizedDate(date);
|
|
|
|
expect(result).toStrictEqual('01-04-2020');
|
|
});
|
|
});
|
|
|
|
describe('when the given date is the 18st of december 2020', (): void => {
|
|
beforeEach((): void => {
|
|
date = new Date(2020, 11, 18);
|
|
});
|
|
|
|
it('should return the date formatted as DD-MM-YYYY', (): void => {
|
|
expect.assertions(1);
|
|
|
|
const result = getHumanizedDate(date);
|
|
|
|
expect(result).toStrictEqual('18-12-2020');
|
|
});
|
|
});
|
|
});
|