Update to Enzyme 3.2.0

feature/default_network_editable
Thomas Huang 7 years ago
parent 28409294c3
commit cefe6cded6
  1. 3
      package.json
  2. 4
      test/helper.js
  3. 15
      test/lib/shallow-with-store.js
  4. 2
      test/unit/components/balance-component-test.js
  5. 2
      test/unit/components/pending-tx-test.js
  6. 6
      test/unit/responsive/components/dropdown-test.js

@ -187,7 +187,8 @@
"deep-freeze-strict": "^1.1.1",
"del": "^3.0.0",
"envify": "^4.0.0",
"enzyme": "^2.8.2",
"enzyme": "^3.2.0",
"enzyme-adapter-react-15": "^1.0.5",
"eslint-plugin-chai": "0.0.1",
"eslint-plugin-mocha": "^4.9.0",
"eslint-plugin-react": "^7.4.0",

@ -1,3 +1,7 @@
import Enzyme from 'enzyme'
import Adapter from 'enzyme-adapter-react-15'
Enzyme.configure({ adapter: new Adapter() })
// disallow promises from swallowing errors
enableFailureOnUnhandledPromiseRejection()

@ -1,11 +1,16 @@
const shallow = require('enzyme').shallow
const { shallow, mount } = require('enzyme')
module.exports = shallowWithStore
function shallowWithStore (component, store) {
exports.shallowWithStore = function shallowWithStore (component, store) {
const context = {
store,
}
return shallow(component, { context })
};
}
exports.mountWithStore = function mountWithStore (component, store) {
const context = {
store,
}
return mount(component, { context })
}

@ -1,7 +1,7 @@
const assert = require('assert')
const h = require('react-hyperscript')
const { createMockStore } = require('redux-test-utils')
const shallowWithStore = require('../../lib/shallow-with-store')
const { shallowWithStore } = require('../../lib/shallow-with-store')
const BalanceComponent = require('../../../ui/app/components/balance-component')
const mockState = {
metamask: {

@ -4,7 +4,7 @@ const PendingTx = require('../../../ui/app/components/pending-tx')
const ethUtil = require('ethereumjs-util')
const { createMockStore } = require('redux-test-utils')
const shallowWithStore = require('../../lib/shallow-with-store')
const { shallowWithStore } = require('../../lib/shallow-with-store')
const identities = { abc: {}, def: {} }
const mockState = {

@ -6,7 +6,7 @@ const path = require('path');
const Dropdown = require(path.join(__dirname, '..', '..', '..', '..', 'ui', 'app', 'components', 'dropdowns', 'index.js')).Dropdown;
const { createMockStore } = require('redux-test-utils')
const shallowWithStore = require('../../../lib/shallow-with-store')
const { mountWithStore } = require('../../../lib/shallow-with-store')
const mockState = {
metamask: {
@ -39,7 +39,7 @@ describe('Dropdown components', function () {
onClick = sinon.spy();
store = createMockStore(mockState)
component = shallowWithStore(h(
component = mountWithStore(h(
Dropdown,
dropdownComponentProps,
[
@ -57,7 +57,7 @@ describe('Dropdown components', function () {
}, 'Item 2'),
]
), store)
dropdownComponent = component.dive()
dropdownComponent = component
})
it('can render two items', function () {

Loading…
Cancel
Save