1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 01:39:44 +01:00

Update to Enzyme 3.2.0

This commit is contained in:
Thomas Huang 2017-11-25 18:37:12 -06:00
parent 28409294c3
commit cefe6cded6
6 changed files with 21 additions and 11 deletions

View File

@ -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",

View File

@ -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()

View File

@ -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 })
}

View File

@ -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: {

View File

@ -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 = {

View File

@ -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 () {