diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/helper.js | 4 | ||||
-rw-r--r-- | test/lib/shallow-with-store.js | 15 | ||||
-rw-r--r-- | test/unit/components/balance-component-test.js | 2 | ||||
-rw-r--r-- | test/unit/components/pending-tx-test.js | 2 | ||||
-rw-r--r-- | test/unit/responsive/components/dropdown-test.js | 6 |
5 files changed, 19 insertions, 10 deletions
diff --git a/test/helper.js b/test/helper.js index 1c5934a89..a3abbebf2 100644 --- a/test/helper.js +++ b/test/helper.js @@ -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() diff --git a/test/lib/shallow-with-store.js b/test/lib/shallow-with-store.js index 411aa0455..2a66adb17 100644 --- a/test/lib/shallow-with-store.js +++ b/test/lib/shallow-with-store.js @@ -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 }) +} diff --git a/test/unit/components/balance-component-test.js b/test/unit/components/balance-component-test.js index a5fededc8..9b1e82acf 100644 --- a/test/unit/components/balance-component-test.js +++ b/test/unit/components/balance-component-test.js @@ -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: { diff --git a/test/unit/components/pending-tx-test.js b/test/unit/components/pending-tx-test.js index 97cac3216..c6c588e1c 100644 --- a/test/unit/components/pending-tx-test.js +++ b/test/unit/components/pending-tx-test.js @@ -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 = { diff --git a/test/unit/responsive/components/dropdown-test.js b/test/unit/responsive/components/dropdown-test.js index 932b6c752..982d8c6ec 100644 --- a/test/unit/responsive/components/dropdown-test.js +++ b/test/unit/responsive/components/dropdown-test.js @@ -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 () { |