1
0
mirror of https://github.com/SomboChea/ui synced 2024-11-28 08:54:27 +07:00

Merge branch '4.x-master' into test/bdd-acceptance-testing-setup

This commit is contained in:
Juan Picado @jotadeveloper 2019-05-03 08:05:06 +02:00 committed by GitHub
commit 313fb33480
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -52,13 +52,21 @@ describe('formatDate', () => {
describe('formatDateDistance', () => { describe('formatDateDistance', () => {
test('should calculate the distance', () => { test('should calculate the distance', () => {
const dateAboutTwoMonthsAgo = () => {
const date = new Date();
date.setMonth(date.getMonth() - 1);
date.setDate(date.getDay() - 20);
return date;
};
const dateTwoMonthsAgo = () => { const dateTwoMonthsAgo = () => {
const date = new Date(); const date = new Date();
date.setMonth(date.getMonth() - 2); date.setMonth(date.getMonth() - 2);
return date; return date;
}; };
const date = dateTwoMonthsAgo(); const date1 = dateAboutTwoMonthsAgo();
expect(formatDateDistance(date)).toEqual('about 2 months'); const date2 = dateTwoMonthsAgo();
expect(formatDateDistance(date1)).toEqual('about 2 months');
expect(formatDateDistance(date2)).toEqual('2 months');
}); });
}); });