From 12f41ad836075a3ef077e60c3b167550c7c0a54b Mon Sep 17 00:00:00 2001 From: afc163 Date: Mon, 23 Oct 2017 21:59:31 +0800 Subject: [PATCH] upgrade enzyme --- .eslintrc | 1 + package.json | 3 ++- src/routes/Dashboard.test.js | 4 +++- tests/setupTests.js | 4 ++++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.eslintrc b/.eslintrc index 941f666a..5209bd9c 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 8840d1d9..a4925b87 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 5e28863f..51605602 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 51ed96ee..7ada61f8 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 = '
'; -- GitLab