diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-11 09:09:48 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-11 09:09:48 +0000 |
commit | 3f3e4bcc50a3280d03299c2c263eafd9c8e3bd7b (patch) | |
tree | eccfc6b87b404f2871cc795bf2f7223a7e391939 /spec/frontend/lib | |
parent | 65a1175e466105fca1f40cb5a995fdb100ff334e (diff) | |
download | gitlab-ce-3f3e4bcc50a3280d03299c2c263eafd9c8e3bd7b.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/lib')
-rw-r--r-- | spec/frontend/lib/utils/datetime_utility_spec.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/frontend/lib/utils/datetime_utility_spec.js b/spec/frontend/lib/utils/datetime_utility_spec.js index 27b88d78ff0..f6878c7c920 100644 --- a/spec/frontend/lib/utils/datetime_utility_spec.js +++ b/spec/frontend/lib/utils/datetime_utility_spec.js @@ -474,6 +474,23 @@ describe('getDateInFuture', () => { }); }); +describe('isValidDate', () => { + it.each` + valueToCheck | isValid + ${new Date()} | ${true} + ${new Date('December 17, 1995 03:24:00')} | ${true} + ${new Date('1995-12-17T03:24:00')} | ${true} + ${new Date('foo')} | ${false} + ${5} | ${false} + ${''} | ${false} + ${false} | ${false} + ${undefined} | ${false} + ${null} | ${false} + `('returns $expectedReturnValue when called with $dateToCheck', ({ valueToCheck, isValid }) => { + expect(datetimeUtility.isValidDate(valueToCheck)).toBe(isValid); + }); +}); + describe('getDatesInRange', () => { it('returns an empty array if 1st or 2nd argument is not a Date object', () => { const d1 = new Date('2019-01-01'); |