You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Tag:
Branch:
Tree:
91601ebe5e
develop
feature/default_network_editable
v10.22.3
${ noResults }
77 lines
1.8 KiB
77 lines
1.8 KiB
import React from 'react';
|
|||
import PropTypes from 'prop-types';
|
|||
import { Provider } from 'react-redux';
|
|||
import sinon from 'sinon';
|
|||
import configureStore from 'redux-mock-store';
|
|||
import { mount } from 'enzyme';
|
|||
import ConfirmRemoveAccount from './confirm-remove-account.container';
|
|||
|
|||
describe('Confirm Remove Account', () => {
|
|||
let wrapper;
|
|||
|
|||
const state = {
|
|||
|
metamask: {},
|
||
};
|
|||
|
|||
const props = {
|
|||
hideModal: sinon.spy(),
|
|||
removeAccount: sinon.stub().resolves(),
|
|||
network: '101',
|
|||
identity: {
|
|||
address: '0x0',
|
|||
name: 'Account 1',
|
|||
},
|
|||
};
|
|||
|
|||
const mockStore = configureStore();
|
|||
const store = mockStore(state);
|
|||
|
|||
beforeEach(() => {
|
|||
wrapper = mount(
|
|||
|
<Provider store={store}>
|
||
<ConfirmRemoveAccount.WrappedComponent {...props} />
|
|||
|
</Provider>,
|
||
{
|
|||
context: {
|
|||
|
t: (str) => str,
|
||
store,
|
|||
},
|
|||
childContextTypes: {
|
|||
t: PropTypes.func,
|
|||
store: PropTypes.object,
|
|||
},
|
|||
},
|
|||
);
|
|||
});
|
|||
|
|||
afterEach(() => {
|
|||
props.hideModal.resetHistory();
|
|||
});
|
|||
|
|||
it('nevermind', () => {
|
|||
const nevermind = wrapper.find({ type: 'default' });
|
|||
nevermind.simulate('click');
|
|||
|
|||
expect(props.hideModal.calledOnce).toStrictEqual(true);
|
|||
});
|
|||
|
|||
it('remove', async () => {
|
|||
const remove = wrapper.find({ type: 'secondary' });
|
|||
remove.simulate('click');
|
|||
|
|||
expect(await props.removeAccount.calledOnce).toStrictEqual(true);
|
|||
expect(props.removeAccount.getCall(0).args[0]).toStrictEqual(
|
|||
|
props.identity.address,
|
||
);
|
|||
|
|||
expect(props.hideModal.calledOnce).toStrictEqual(true);
|
|||
});
|
|||
|
|||
it('closes', () => {
|
|||
const close = wrapper.find('.modal-container__header-close');
|
|||
close.simulate('click');
|
|||
|
|||
expect(props.hideModal.calledOnce).toStrictEqual(true);
|
|||
});
|
|||
});
|