Skip to content

Commit

Permalink
Update niceDate tests to avoid timezone issues
Browse files Browse the repository at this point in the history
Fixes #24
Closes #25
The formatting is the main thing we want to test, not the exact date being correct (we can assume the JS engine will not fail us).
  • Loading branch information
cookpete committed Jan 15, 2018
1 parent 8cbe121 commit 08e90f3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ describe('cmd', () => {

describe('niceDate', () => {
it('formats string into nice date', () => {
expect(niceDate('2015-10-03')).to.equal('3 October 2015')
expect(niceDate('2017-11-07T19:19:02.635Z')).to.equal('7 November 2017')
expect(niceDate('2015-10-03')).to.match(/^\d October 2015$/)
expect(niceDate('2017-11-07T19:19:02.635Z')).to.match(/^\d November 2017$/)
})

it('formats date into nice date', () => {
expect(niceDate(new Date(2016, 8, 2))).to.equal('2 September 2016')
expect(niceDate(new Date('2015-10-03'))).to.equal('3 October 2015')
expect(niceDate(new Date(2016, 8, 2))).to.match(/^\d September 2016$/)
expect(niceDate(new Date('2015-10-03'))).to.match(/^\d October 2015$/)
})
})

Expand Down

0 comments on commit 08e90f3

Please sign in to comment.