From d8d699ff17a972729b89cb7505a95257ee859b57 Mon Sep 17 00:00:00 2001 From: Clement Ho Date: Thu, 25 Aug 2016 20:19:44 -0500 Subject: Convert datetime coffeescript spec to ES6 --- CHANGELOG | 1 + spec/javascripts/datetime_utility_spec.js.coffee | 50 ------------------ spec/javascripts/datetime_utility_spec.js.es6 | 64 ++++++++++++++++++++++++ 3 files changed, 65 insertions(+), 50 deletions(-) delete mode 100644 spec/javascripts/datetime_utility_spec.js.coffee create mode 100644 spec/javascripts/datetime_utility_spec.js.es6 diff --git a/CHANGELOG b/CHANGELOG index 934dabe743a..a655db6e236 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -58,6 +58,7 @@ v 8.12.0 (unreleased) - Move to project dropdown with infinite scroll for better performance - Fix leaking of submit buttons outside the width of a main container !18731 (originally by @pavelloz) - Load branches asynchronously in Cherry Pick and Revert dialogs. + - Convert datetime coffeescript spec to ES6 (ClemMakesApps) - Add merge request versions !5467 - Change using size to use count and caching it for number of group members. !5935 - Replace play icon font with svg (ClemMakesApps) diff --git a/spec/javascripts/datetime_utility_spec.js.coffee b/spec/javascripts/datetime_utility_spec.js.coffee deleted file mode 100644 index 8bd113e7d86..00000000000 --- a/spec/javascripts/datetime_utility_spec.js.coffee +++ /dev/null @@ -1,50 +0,0 @@ -#= require lib/utils/datetime_utility - -describe 'Date time utils', -> - describe 'get day name', -> - it 'should return Sunday', -> - day = gl.utils.getDayName(new Date('07/17/2016')) - expect(day).toBe('Sunday') - - it 'should return Monday', -> - day = gl.utils.getDayName(new Date('07/18/2016')) - expect(day).toBe('Monday') - - it 'should return Tuesday', -> - day = gl.utils.getDayName(new Date('07/19/2016')) - expect(day).toBe('Tuesday') - - it 'should return Wednesday', -> - day = gl.utils.getDayName(new Date('07/20/2016')) - expect(day).toBe('Wednesday') - - it 'should return Thursday', -> - day = gl.utils.getDayName(new Date('07/21/2016')) - expect(day).toBe('Thursday') - - it 'should return Friday', -> - day = gl.utils.getDayName(new Date('07/22/2016')) - expect(day).toBe('Friday') - - it 'should return Saturday', -> - day = gl.utils.getDayName(new Date('07/23/2016')) - expect(day).toBe('Saturday') - - describe 'get day difference', -> - it 'should return 7', -> - firstDay = new Date('07/01/2016') - secondDay = new Date('07/08/2016') - difference = gl.utils.getDayDifference(firstDay, secondDay) - expect(difference).toBe(7) - - it 'should return 31', -> - firstDay = new Date('07/01/2016') - secondDay = new Date('08/01/2016') - difference = gl.utils.getDayDifference(firstDay, secondDay) - expect(difference).toBe(31) - - it 'should return 365', -> - firstDay = new Date('07/02/2015') - secondDay = new Date('07/01/2016') - difference = gl.utils.getDayDifference(firstDay, secondDay) - expect(difference).toBe(365) \ No newline at end of file diff --git a/spec/javascripts/datetime_utility_spec.js.es6 b/spec/javascripts/datetime_utility_spec.js.es6 new file mode 100644 index 00000000000..a2d1b0a7732 --- /dev/null +++ b/spec/javascripts/datetime_utility_spec.js.es6 @@ -0,0 +1,64 @@ +//= require lib/utils/datetime_utility +(() => { + describe('Date time utils', () => { + describe('get day name', () => { + it('should return Sunday', () => { + const day = gl.utils.getDayName(new Date('07/17/2016')); + expect(day).toBe('Sunday'); + }); + + it('should return Monday', () => { + const day = gl.utils.getDayName(new Date('07/18/2016')); + expect(day).toBe('Monday'); + }); + + it('should return Tuesday', () => { + const day = gl.utils.getDayName(new Date('07/19/2016')); + expect(day).toBe('Tuesday'); + }); + + it('should return Wednesday', () => { + const day = gl.utils.getDayName(new Date('07/20/2016')); + expect(day).toBe('Wednesday'); + }); + + it('should return Thursday', () => { + const day = gl.utils.getDayName(new Date('07/21/2016')); + expect(day).toBe('Thursday'); + }); + + it('should return Friday', () => { + const day = gl.utils.getDayName(new Date('07/22/2016')); + expect(day).toBe('Friday'); + }); + + it('should return Saturday', () => { + const day = gl.utils.getDayName(new Date('07/23/2016')); + expect(day).toBe('Saturday'); + }); + }); + + describe('get day difference', () => { + it('should return 7', () => { + const firstDay = new Date('07/01/2016'); + const secondDay = new Date('07/08/2016'); + const difference = gl.utils.getDayDifference(firstDay, secondDay); + expect(difference).toBe(7); + }); + + it('should return 31', () => { + const firstDay = new Date('07/01/2016'); + const secondDay = new Date('08/01/2016'); + const difference = gl.utils.getDayDifference(firstDay, secondDay); + expect(difference).toBe(31); + }); + + it('should return 365', () => { + const firstDay = new Date('07/02/2015'); + const secondDay = new Date('07/01/2016'); + const difference = gl.utils.getDayDifference(firstDay, secondDay); + expect(difference).toBe(365); + }); + }); + }); +})(); -- cgit v1.2.1