diff --git a/.eslintrc b/.eslintrc index 941f666a7775d0a1459cffccbbcc894ac2b66b71..5209bd9cfb7284febd24237ebe8a47124fc1622d 100755 --- a/.eslintrc +++ b/.eslintrc @@ -6,6 +6,7 @@ "node": true, "es6": true, "mocha": true, + "jest": true, "jasmine": true }, "rules": { diff --git a/package.json b/package.json index 8840d1d982fc68c01d594ad5c5ce4eb9283c9c99..a4925b8788071b0c821fe7ed50855769e073b012 100755 --- a/package.json +++ b/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", diff --git a/src/routes/Dashboard.test.js b/src/routes/Dashboard.test.js index 5e28863f6a404faf3854b0856fd540e3dbf3ac53..51605602243e054ba534e4891f5ffe451626f56a 100644 --- a/src/routes/Dashboard.test.js +++ b/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( - + ); expect(wrapper.find('Table').props().dataSource).toEqual([]); + expect(fetchFn).toBeCalled(); }); diff --git a/tests/setupTests.js b/tests/setupTests.js index 51ed96ee2f248c677c371e31ac5553102f76acb6..7ada61f8ad46a8daa612ece4c231aef68d8672ff 100644 --- a/tests/setupTests.js +++ b/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 = '
';