From 08e90f31d34367403dfa9f1de2773a9bbcbe7bd2 Mon Sep 17 00:00:00 2001 From: Pete Cook Date: Mon, 15 Jan 2018 07:29:22 +0000 Subject: [PATCH] Update niceDate tests to avoid timezone issues Fixes https://github.com/CookPete/auto-changelog/issues/24 Closes https://github.com/CookPete/auto-changelog/pull/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). --- test/utils.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/utils.js b/test/utils.js index 6ef7d5fd..d270f1c8 100644 --- a/test/utils.js +++ b/test/utils.js @@ -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$/) }) })