diff options
author | Bob Van Landuyt <bob@gitlab.com> | 2017-06-07 20:13:44 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2017-06-07 20:13:44 +0000 |
commit | bdebe849b8251f390378dd446d9022fca1b2d55c (patch) | |
tree | 770a9e8312e376c46fd8a2d033de81bc5184a6e2 /spec/javascripts/datetime_utility_spec.js | |
parent | c17c7c29d7e562b1661397ac4c1af4044c3ac7cb (diff) | |
download | gitlab-ce-bdebe849b8251f390378dd446d9022fca1b2d55c.tar.gz |
Translate project & repository pages
Diffstat (limited to 'spec/javascripts/datetime_utility_spec.js')
-rw-r--r-- | spec/javascripts/datetime_utility_spec.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/javascripts/datetime_utility_spec.js b/spec/javascripts/datetime_utility_spec.js index e347c980c78..c82ad0bea48 100644 --- a/spec/javascripts/datetime_utility_spec.js +++ b/spec/javascripts/datetime_utility_spec.js @@ -2,6 +2,26 @@ import '~/lib/utils/datetime_utility'; (() => { describe('Date time utils', () => { + describe('timeFor', () => { + it('returns `past due` when in past', () => { + const date = new Date(); + date.setFullYear(date.getFullYear() - 1); + + expect( + gl.utils.timeFor(date), + ).toBe('Past due'); + }); + + it('returns remaining time when in the future', () => { + const date = new Date(); + date.setFullYear(date.getFullYear() + 1); + + expect( + gl.utils.timeFor(date), + ).toBe('1 year remaining'); + }); + }); + describe('get day name', () => { it('should return Sunday', () => { const day = gl.utils.getDayName(new Date('07/17/2016')); |