From d523604c9bfa2fb9a742ca9ffb1597312b91629e Mon Sep 17 00:00:00 2001 From: tangjinzhou <415800467@qq.com> Date: Sun, 19 Sep 2021 16:50:18 +0800 Subject: [PATCH] test: mock date --- tests/shared/demoTest.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/shared/demoTest.js b/tests/shared/demoTest.js index e82fe1b3f..09673ee53 100644 --- a/tests/shared/demoTest.js +++ b/tests/shared/demoTest.js @@ -3,10 +3,8 @@ import { mount } from '@vue/test-utils'; import MockDate from 'mockdate'; import dayjs from 'dayjs'; import antd from 'ant-design-vue'; -import utc from 'dayjs/plugin/utc'; import { sleep } from '../utils'; -dayjs.extend(utc); export default function demoTest(component, options = {}) { const suffix = options.suffix || 'vue'; const files = glob.sync(`./components/${component}/demo/*.${suffix}`); @@ -20,7 +18,7 @@ export default function demoTest(component, options = {}) { testMethod = test.skip; } testMethod(`renders ${file} correctly`, async () => { - MockDate.set(dayjs.utc('2016-11-22').valueOf()); + MockDate.set(dayjs('2016-11-22T00:00:00Z').valueOf()); const demo = require(`../.${file}`).default || require(`../.${file}`); document.body.innerHTML = ''; const wrapper = mount(demo, { global: { plugins: [antd] }, attachTo: document.body });