Commit 12f41ad8 authored by afc163's avatar afc163

upgrade enzyme

parent c6e28e66
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
"node": true, "node": true,
"es6": true, "es6": true,
"mocha": true, "mocha": true,
"jest": true,
"jasmine": true "jasmine": true
}, },
"rules": { "rules": {
......
...@@ -3,8 +3,10 @@ import { shallow } from 'enzyme'; ...@@ -3,8 +3,10 @@ import { shallow } from 'enzyme';
import Dashboard from './Dashboard'; import Dashboard from './Dashboard';
it('renders Dashboard', () => { it('renders Dashboard', () => {
const fetchFn = jest.fn();
const wrapper = shallow( const wrapper = shallow(
<Dashboard.WrappedComponent user={{ list: [] }} /> <Dashboard.WrappedComponent user={{ list: [] }} dispatch={fetchFn} />
); );
expect(wrapper.find('Table').props().dataSource).toEqual([]); expect(wrapper.find('Table').props().dataSource).toEqual([]);
expect(fetchFn).toBeCalled();
}); });
import { jsdom } from 'jsdom'; import { jsdom } from 'jsdom';
import Enzyme from 'enzyme';
import Adapter from 'enzyme-adapter-react-15';
Enzyme.configure({ adapter: new Adapter() });
// fixed jsdom miss // fixed jsdom miss
const documentHTML = '<!doctype html><html><body><div id="root"></div></body></html>'; const documentHTML = '<!doctype html><html><body><div id="root"></div></body></html>';
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment