diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-25 18:06:45 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-25 18:06:45 +0300 |
commit | ed9c54b56af280cc552aaac1cfa55533c900c1be (patch) | |
tree | 99605e6980c1673566fe7f293f9e4fe8dcdc4416 /spec/frontend/lib | |
parent | 8f1f6b374b69fd6356bdc5561d56f5ca9db9fadd (diff) |
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 | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/frontend/lib/utils/datetime_utility_spec.js b/spec/frontend/lib/utils/datetime_utility_spec.js index ee27789b6b9..fd75c9aa0cd 100644 --- a/spec/frontend/lib/utils/datetime_utility_spec.js +++ b/spec/frontend/lib/utils/datetime_utility_spec.js @@ -482,3 +482,27 @@ describe('secondsToMilliseconds', () => { expect(datetimeUtility.secondsToMilliseconds(123)).toBe(123000); }); }); + +describe('dayAfter', () => { + const date = new Date('2019-07-16T00:00:00.000Z'); + + it('returns the following date', () => { + const nextDay = datetimeUtility.dayAfter(date); + const expectedNextDate = new Date('2019-07-17T00:00:00.000Z'); + + expect(nextDay).toStrictEqual(expectedNextDate); + }); + + it('does not modifiy the original date', () => { + datetimeUtility.dayAfter(date); + expect(date).toStrictEqual(new Date('2019-07-16T00:00:00.000Z')); + }); +}); + +describe('secondsToDays', () => { + it('converts seconds to days correctly', () => { + expect(datetimeUtility.secondsToDays(0)).toBe(0); + expect(datetimeUtility.secondsToDays(90000)).toBe(1); + expect(datetimeUtility.secondsToDays(270000)).toBe(3); + }); +}); |