another try (#16077)

This commit is contained in:
zombieJ 2019-04-15 14:56:21 +08:00 committed by GitHub
parent 321a12eb6c
commit 15b900bbfb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -219,7 +219,9 @@ describe('DatePicker', () => {
});
describe('warning use if use invalidate moment', () => {
const warnSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
const invalidateTime = moment('I AM INVALIDATE');
warnSpy.mockReset();
it('defaultValue', () => {
mount(<DatePicker defaultValue={invalidateTime} />);

View File

@ -1,19 +1,22 @@
import React from 'react';
import { mount, render } from 'enzyme';
import debounce from 'lodash/debounce';
import Tree from '../index';
const { DirectoryTree, TreeNode } = Tree;
const mockDebounce = jest.mock('lodash/debounce', () => fn => fn);
jest.mock('lodash/debounce');
describe('Directory Tree', () => {
debounce.mockImplementation(fn => fn);
beforeAll(() => {
jest.useFakeTimers();
});
afterAll(() => {
jest.useRealTimers();
mockDebounce.mockRestore();
debounce.mockRestore();
});
function createTree(props) {