Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/lib/utils/datetime/date_format_utility_spec.js')
-rw-r--r--spec/frontend/lib/utils/datetime/date_format_utility_spec.js15
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);
+ },
+ );
+});