diff --git a/components/date-picker/__tests__/DatePicker.test.js b/components/date-picker/__tests__/DatePicker.test.js index c698e35df8..d7de7f5316 100644 --- a/components/date-picker/__tests__/DatePicker.test.js +++ b/components/date-picker/__tests__/DatePicker.test.js @@ -17,7 +17,7 @@ describe('DatePicker', () => { focusTest(DatePicker); beforeEach(() => { - MockDate.set(new Date('2016-11-22')); + MockDate.set(moment('2016-11-22')); }); afterEach(() => { diff --git a/tests/shared/demoTest.js b/tests/shared/demoTest.js index 4e4da1c1a5..09979dd3c4 100644 --- a/tests/shared/demoTest.js +++ b/tests/shared/demoTest.js @@ -1,6 +1,7 @@ import glob from 'glob'; import { render } from 'enzyme'; import MockDate from 'mockdate'; +import moment from 'moment'; export default function demoTest(component, options = {}) { const files = glob.sync(`./components/${component}/demo/*.md`); @@ -11,7 +12,7 @@ export default function demoTest(component, options = {}) { testMethod = test.skip; } testMethod(`renders ${file} correctly`, () => { - MockDate.set(new Date('2016-11-22').getTime() + (new Date().getTimezoneOffset() * 60 * 1000)); + MockDate.set(moment('2016-11-22')); const demo = require(`../.${file}`).default; // eslint-disable-line global-require, import/no-dynamic-require const wrapper = render(demo); expect(wrapper).toMatchSnapshot();