From e22870f5d70db53656778fb945cc740e6e8d2065 Mon Sep 17 00:00:00 2001 From: harttle Date: Fri, 6 Oct 2017 12:16:03 +0800 Subject: [PATCH] fix: broken unit test by UTC time parsing behaviour change --- test/util/strftime.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/util/strftime.js b/test/util/strftime.js index 4ebaed3bb..29440d4c2 100644 --- a/test/util/strftime.js +++ b/test/util/strftime.js @@ -8,8 +8,8 @@ describe('util/strftime', function () { var then before(function () { mockUTC() - now = new Date('2016-01-04T13:15:23') - then = new Date('2016-03-06T03:05:03') + now = new Date('2016-01-04T13:15:23.000Z') + then = new Date('2016-03-06T03:05:03.000Z') }) after(function () { restoreUTC() @@ -37,7 +37,7 @@ describe('util/strftime', function () { expect(t(now, '%I')).to.equal('01') }) it('should format %I as 12 for 00:00', function () { - var date = new Date('2016-01-01T00:00:00') + var date = new Date('2016-01-01T00:00:00.000Z') expect(t(date, '%I')).to.equal('12') }) describe('%j', function () { @@ -60,7 +60,7 @@ describe('util/strftime', function () { expect(t(now, '%l')).to.equal(' 1') }) it('should format %l as 12 for 00:00', function () { - var date = new Date('2016-01-01T00:00:00') + var date = new Date('2016-01-01T00:00:00.000Z') expect(t(date, '%l')).to.equal('12') }) it('should format %L as 0 padded millisecond', function () { @@ -75,9 +75,9 @@ describe('util/strftime', function () { expect(t(then, '%P')).to.equal('am') }) it('should format %q as date suffix', function () { - var st = new Date('2016-03-01T03:05:03') - var nd = new Date('2016-03-02T03:05:03') - var rd = new Date('2016-03-03T03:05:03') + var st = new Date('2016-03-01T03:05:03.000Z') + var nd = new Date('2016-03-02T03:05:03.000Z') + var rd = new Date('2016-03-03T03:05:03.000Z') expect(t(st, '%q')).to.equal('st') expect(t(nd, '%q')).to.equal('nd') expect(t(rd, '%q')).to.equal('rd') @@ -113,7 +113,7 @@ describe('util/strftime', function () { expect(t(now, '%z')).to.equal('+0800') }) it('should format %z as negative time zone', function () { - var date = new Date('2016-01-04T13:15:23') + var date = new Date('2016-01-04T13:15:23.000Z') date.getTimezoneOffset = () => 480 expect(t(date, '%z')).to.equal('-0800') })