diff --git a/lib/text-formatters.spec.js b/lib/text-formatters.spec.js index fdf934e7e7..6629e3752b 100644 --- a/lib/text-formatters.spec.js +++ b/lib/text-formatters.spec.js @@ -1,7 +1,7 @@ 'use strict'; const { test, given } = require('sazerac'); -const moment = require('moment'); +const sinon = require('sinon'); const { starRating, currencyFromCode, @@ -76,6 +76,15 @@ describe('Text formatters', function() { test(formatDate, () => { given(1465513200000).describe('when given a timestamp in june 2016').expect('june 2016'); - given(moment().startOf('year')).describe('when given the beginning of this year').expect('january'); + }); + + context('in october', function () { + beforeEach(function () { + sinon.useFakeTimers(new Date(2017, 9, 15).getTime()); + }); + + test(formatDate, () => { + given(new Date(2017, 0, 1).getTime()).describe('when given the beginning of this year').expect('january'); + }); }); });