diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-26 18:07:59 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-26 18:07:59 +0300 |
commit | c46e0d0c271a21b67a3412faf750d27dd63432bb (patch) | |
tree | 58d5ac8c94228c1c282f3ca3929eeb61b65c6c36 /spec/frontend/lib | |
parent | a46fed716c91d449fde2f08d25e0f4530170bc15 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/lib')
-rw-r--r-- | spec/frontend/lib/utils/datetime/date_format_utility_spec.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/frontend/lib/utils/datetime/date_format_utility_spec.js b/spec/frontend/lib/utils/datetime/date_format_utility_spec.js index e7a6367eeac..65018fe1625 100644 --- a/spec/frontend/lib/utils/datetime/date_format_utility_spec.js +++ b/spec/frontend/lib/utils/datetime/date_format_utility_spec.js @@ -152,3 +152,18 @@ describe('formatUtcOffset', () => { expect(utils.formatUtcOffset(offset)).toEqual(expected); }); }); + +describe('humanTimeframe', () => { + it.each` + startDate | dueDate | returnValue + ${'2021-1-1'} | ${'2021-2-28'} | ${'Jan 1 – Feb 28, 2021'} + ${'2021-1-1'} | ${'2022-2-28'} | ${'Jan 1, 2021 – Feb 28, 2022'} + ${'2021-1-1'} | ${null} | ${'Jan 1, 2021 – No due date'} + ${null} | ${'2021-2-28'} | ${'No start date – Feb 28, 2021'} + `( + 'returns string "$returnValue" when startDate is $startDate and dueDate is $dueDate', + ({ startDate, dueDate, returnValue }) => { + expect(utils.humanTimeframe(startDate, dueDate)).toBe(returnValue); + }, + ); +}); |