Browse Source

upgrade enzyme

pull/25/head
afc163 9 years ago
parent
commit
12f41ad836
  1. 1
      .eslintrc
  2. 3
      package.json
  3. 4
      src/routes/Dashboard.test.js
  4. 4
      tests/setupTests.js

1
.eslintrc

@ -6,6 +6,7 @@
"node": true,
"es6": true,
"mocha": true,
"jest": true,
"jasmine": true
},
"rules": {

3
package.json

@ -33,7 +33,8 @@
"babel-plugin-transform-runtime": "^6.9.0",
"babel-runtime": "^6.9.2",
"cross-port-killer": "^1.0.1",
"enzyme": "^2.9.1",
"enzyme": "^3.1.0",
"enzyme-adapter-react-15": "^1.0.2",
"eslint": "^4.8.0",
"eslint-config-airbnb": "^16.0.0",
"eslint-plugin-babel": "^4.0.0",

4
src/routes/Dashboard.test.js

@ -3,8 +3,10 @@ import { shallow } from 'enzyme';
import Dashboard from './Dashboard';
it('renders Dashboard', () => {
const fetchFn = jest.fn();
const wrapper = shallow(
<Dashboard.WrappedComponent user={{ list: [] }} />
<Dashboard.WrappedComponent user={{ list: [] }} dispatch={fetchFn} />
);
expect(wrapper.find('Table').props().dataSource).toEqual([]);
expect(fetchFn).toBeCalled();
});

4
tests/setupTests.js

@ -1,4 +1,8 @@
import { jsdom } from 'jsdom';
import Enzyme from 'enzyme';
import Adapter from 'enzyme-adapter-react-15';
Enzyme.configure({ adapter: new Adapter() });
// fixed jsdom miss
const documentHTML = '<!doctype html><html><body><div id="root"></div></body></html>';

Loading…
Cancel
Save