Fix January unit test (#1417)

This commit is contained in:
Paul Melnikow
2018-01-03 20:37:35 -07:00
committed by GitHub
parent 9cb9d5984d
commit ccb3eb8fdf

View File

@@ -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');
});
});
});