Skip to content

Commit

Permalink
✅ Adjust unit test due to change on headerV2
Browse files Browse the repository at this point in the history
  • Loading branch information
massao committed May 6, 2019
1 parent 081f1ba commit b47305d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/components/hwWalletLogin/hwWalletLogin.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import React from 'react';
import { MemoryRouter as Router } from 'react-router-dom';
import PropTypes from 'prop-types';
import configureMockStore from 'redux-mock-store';
import { mount } from 'enzyme';
import * as hwWalletUtils from '../../utils/hwWallet';
import HwWalletLogin from './hwWalletLogin';
Expand All @@ -8,20 +10,28 @@ jest.mock('../../utils/hwWallet');

describe('HwWalletLogin', () => {
let wrapper;
const store = configureMockStore([])({});
const props = {
devices: [],
devicesListUpdated: jest.fn(),
t: key => key,
};

const options = {
context: { store },
childContextTypes: {
store: PropTypes.object.isRequired,
},
};

it('Should render Loading component and call getDeviceList ', async () => {
hwWalletUtils.getDeviceList.mockResolvedValue([
{ deviceId: 1, openApp: false, model: 'Ledger' },
{ deviceId: 2, model: 'Trezor' },
{ deviceId: 3, openApp: true, model: 'Ledger' },
]);

wrapper = mount(<Router><HwWalletLogin {...props} /></Router>);
wrapper = mount(<Router><HwWalletLogin {...props} /></Router>, options);
const devices = await hwWalletUtils.getDeviceList();
expect(wrapper).toContainMatchingElement('Loading');
expect(props.devicesListUpdated).toBeCalledWith(devices);
Expand Down

0 comments on commit b47305d

Please sign in to comment.